Commit f8f0935e authored by alex yao's avatar alex yao

feat[长文阅读]:新增关键词/思维导图

parent 6935d327
...@@ -13,6 +13,8 @@ public class BizLongTextSummaryCacheConvert { ...@@ -13,6 +13,8 @@ public class BizLongTextSummaryCacheConvert {
entity.setSummary(model.getSummary()); entity.setSummary(model.getSummary());
entity.setFileUrl(model.getFileUrl()); entity.setFileUrl(model.getFileUrl());
entity.setFileMd5(model.getFileMd5()); entity.setFileMd5(model.getFileMd5());
entity.setKeyword(model.getKeyword());
entity.setMindmap(model.getMindmap());
entity.setIsDeleted(model.getIsDeleted()); entity.setIsDeleted(model.getIsDeleted());
entity.setCreator(model.getCreator()); entity.setCreator(model.getCreator());
entity.setCreatedTime(model.getCreatedTime()); entity.setCreatedTime(model.getCreatedTime());
...@@ -27,6 +29,8 @@ public class BizLongTextSummaryCacheConvert { ...@@ -27,6 +29,8 @@ public class BizLongTextSummaryCacheConvert {
model.setId(entity.getId()); model.setId(entity.getId());
model.setCorePoint(entity.getCorePoint()); model.setCorePoint(entity.getCorePoint());
model.setSummary(entity.getSummary()); model.setSummary(entity.getSummary());
model.setKeyword(entity.getKeyword());
model.setMindmap(entity.getMindmap());
model.setFileUrl(entity.getFileUrl()); model.setFileUrl(entity.getFileUrl());
model.setFileMd5(entity.getFileMd5()); model.setFileMd5(entity.getFileMd5());
model.setIsDeleted(entity.getIsDeleted()); model.setIsDeleted(entity.getIsDeleted());
......
package cn.com.poc.long_document.domain;
import java.util.List;
/**
* @author alex.yao
* @date 2025/8/29
*/
public class MindMap {
private String id;
private String topic;
private Boolean root;
private List<MindMap> children;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public Boolean getRoot() {
return root;
}
public void setRoot(Boolean root) {
this.root = root;
}
public List<MindMap> getChildren() {
return children;
}
public void setChildren(List<MindMap> children) {
this.children = children;
}
}
package cn.com.poc.long_document.dto; package cn.com.poc.long_document.dto;
import cn.com.poc.long_document.domain.MindMap;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.List;
/** /**
* @author alex.yao * @author alex.yao
* @date 2025/6/18 * @date 2025/6/18
*/ */
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class LongTextSummaryDto { public class LongTextSummaryDto {
private String summary; private String summary;
private String corePoint; private String corePoint;
private List<String> keyword;
private MindMap mindMap;
public List<String> getKeyword() {
return keyword;
}
public void setKeyword(List<String> keyword) {
this.keyword = keyword;
}
public MindMap getMindMap() {
return mindMap;
}
public void setMindMap(MindMap mindMap) {
this.mindMap = mindMap;
}
public String getSummary() { public String getSummary() {
return summary; return summary;
} }
......
package cn.com.poc.long_document.entity; package cn.com.poc.long_document.entity;
import javax.persistence.Column;
public class BizLongTextSummaryCacheEntity { public class BizLongTextSummaryCacheEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -40,6 +42,34 @@ public class BizLongTextSummaryCacheEntity { ...@@ -40,6 +42,34 @@ public class BizLongTextSummaryCacheEntity {
public void setSummary(java.lang.String summary){ public void setSummary(java.lang.String summary){
this.summary = summary; this.summary = summary;
} }
/** keyword
*关键词
*/
private java.lang.String keyword;
public java.lang.String getKeyword(){
return this.keyword;
}
public void setKeyword(java.lang.String keyword){
this.keyword = keyword;
}
/** mindmap
*思维导图
*/
private java.lang.String mindmap;
public java.lang.String getMindmap(){
return this.mindmap;
}
public void setMindmap(java.lang.String mindmap){
this.mindmap = mindmap;
}
/** file_url /** file_url
*文件地址 *文件地址
*/ */
......
...@@ -72,6 +72,38 @@ public class BizLongTextSummaryCacheModel extends BaseModelClass implements Seri ...@@ -72,6 +72,38 @@ public class BizLongTextSummaryCacheModel extends BaseModelClass implements Seri
this.summary = summary; this.summary = summary;
super.addValidField("summary"); super.addValidField("summary");
} }
/** keyword
*关键词
*/
private java.lang.String keyword;
@Column(name = "keyword",length = 2147483647)
public java.lang.String getKeyword(){
return this.keyword;
}
public void setKeyword(java.lang.String keyword){
this.keyword = keyword;
super.addValidField("keyword");
}
/** mindmap
*思维导图
*/
private java.lang.String mindmap;
@Column(name = "mindmap",length = 2147483647)
public java.lang.String getMindmap(){
return this.mindmap;
}
public void setMindmap(java.lang.String mindmap){
this.mindmap = mindmap;
super.addValidField("mindmap");
}
/** file_url /** file_url
......
package cn.com.poc.long_document.service.impl; package cn.com.poc.long_document.service.impl;
import cn.com.yict.framemax.core.service.impl.BaseServiceImpl; import cn.com.yict.framemax.core.service.impl.BaseServiceImpl;
import cn.com.poc.long_document.service.BizLongTextSummaryCacheService; import cn.com.poc.long_document.service.BizLongTextSummaryCacheService;
...@@ -10,103 +10,111 @@ import cn.com.yict.framemax.data.model.PagingInfo; ...@@ -10,103 +10,111 @@ import cn.com.yict.framemax.data.model.PagingInfo;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.List; import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@Service @Service
public class BizLongTextSummaryCacheServiceImpl extends BaseServiceImpl public class BizLongTextSummaryCacheServiceImpl extends BaseServiceImpl
implements BizLongTextSummaryCacheService { implements BizLongTextSummaryCacheService {
@Resource @Resource
private BizLongTextSummaryCacheRepository repository; private BizLongTextSummaryCacheRepository repository;
public BizLongTextSummaryCacheEntity get(java.lang.Long id) throws Exception{ public BizLongTextSummaryCacheEntity get(java.lang.Long id) throws Exception {
Assert.notNull(id); Assert.notNull(id);
BizLongTextSummaryCacheModel model = this.repository.get(id); BizLongTextSummaryCacheModel model = this.repository.get(id);
if (model == null){ if (model == null) {
return null; return null;
} }
if ("Y".equals(model.getIsDeleted())){ if ("Y".equals(model.getIsDeleted())) {
return null; return null;
} }
return BizLongTextSummaryCacheConvert.modelToEntity(model); return BizLongTextSummaryCacheConvert.modelToEntity(model);
} }
public List<BizLongTextSummaryCacheEntity> findByExample(BizLongTextSummaryCacheEntity example, PagingInfo pagingInfo) throws Exception {
public List<BizLongTextSummaryCacheEntity> findByExample(BizLongTextSummaryCacheEntity example,PagingInfo pagingInfo) throws Exception{ List<BizLongTextSummaryCacheEntity> result = new ArrayList<BizLongTextSummaryCacheEntity>();
List<BizLongTextSummaryCacheEntity> result = new ArrayList<BizLongTextSummaryCacheEntity>();
BizLongTextSummaryCacheModel model = new BizLongTextSummaryCacheModel(); BizLongTextSummaryCacheModel model = new BizLongTextSummaryCacheModel();
if (example != null){ if (example != null) {
model = BizLongTextSummaryCacheConvert.entityToModel(example); model = BizLongTextSummaryCacheConvert.entityToModel(example);
} }
model.setIsDeleted("N"); model.setIsDeleted("N");
List<BizLongTextSummaryCacheModel> models = this.repository.findByExample(model,pagingInfo); List<BizLongTextSummaryCacheModel> models = this.repository.findByExample(model, pagingInfo);
if (CollectionUtils.isNotEmpty(models)) { if (CollectionUtils.isNotEmpty(models)) {
result = models.stream().map(BizLongTextSummaryCacheConvert::modelToEntity).collect(Collectors.toList()); result = models.stream().map(BizLongTextSummaryCacheConvert::modelToEntity).collect(Collectors.toList());
} }
return result; return result;
} }
public BizLongTextSummaryCacheEntity save(BizLongTextSummaryCacheEntity entity) throws Exception{ public BizLongTextSummaryCacheEntity save(BizLongTextSummaryCacheEntity entity) throws Exception {
Assert.notNull(entity); Assert.notNull(entity);
entity.setId(null); entity.setId(null);
entity.setIsDeleted("N"); entity.setIsDeleted("N");
BizLongTextSummaryCacheModel model = BizLongTextSummaryCacheConvert.entityToModel(entity); BizLongTextSummaryCacheModel model = BizLongTextSummaryCacheConvert.entityToModel(entity);
BizLongTextSummaryCacheModel saveModel = this.repository.save(model); BizLongTextSummaryCacheModel saveModel = this.repository.save(model);
return BizLongTextSummaryCacheConvert.modelToEntity(saveModel); return BizLongTextSummaryCacheConvert.modelToEntity(saveModel);
} }
public BizLongTextSummaryCacheEntity update(BizLongTextSummaryCacheEntity entity) throws Exception{ public BizLongTextSummaryCacheEntity update(BizLongTextSummaryCacheEntity entity) throws Exception {
Assert.notNull(entity); Assert.notNull(entity);
Assert.notNull(entity.getId(),"update pk can not be null"); Assert.notNull(entity.getId(), "update pk can not be null");
BizLongTextSummaryCacheModel model = this.repository.get(entity.getId()); BizLongTextSummaryCacheModel model = this.repository.get(entity.getId());
if (entity.getCorePoint() != null){ if (entity.getCorePoint() != null) {
model.setCorePoint(entity.getCorePoint()); model.setCorePoint(entity.getCorePoint());
} }
if (entity.getSummary() != null){ if (entity.getSummary() != null) {
model.setSummary(entity.getSummary()); model.setSummary(entity.getSummary());
} }
if (entity.getFileUrl() != null){ if (entity.getFileUrl() != null) {
model.setFileUrl(entity.getFileUrl()); model.setFileUrl(entity.getFileUrl());
} }
if (entity.getFileMd5() != null){ if (entity.getMindmap() != null) {
model.setFileMd5(entity.getFileMd5()); model.setMindmap(entity.getMindmap());
} }
if (entity.getIsDeleted() != null){ if (entity.getKeyword() != null) {
model.setIsDeleted(entity.getIsDeleted()); model.setKeyword(entity.getKeyword());
} }
if (entity.getCreator() != null){ if (entity.getFileMd5() != null) {
model.setCreator(entity.getCreator()); model.setFileMd5(entity.getFileMd5());
} }
if (entity.getCreatedTime() != null){ if (entity.getIsDeleted() != null) {
model.setCreatedTime(entity.getCreatedTime()); model.setIsDeleted(entity.getIsDeleted());
} }
if (entity.getModifier() != null){ if (entity.getCreator() != null) {
model.setModifier(entity.getModifier()); model.setCreator(entity.getCreator());
} }
if (entity.getModifiedTime() != null){ if (entity.getCreatedTime() != null) {
model.setModifiedTime(entity.getModifiedTime()); model.setCreatedTime(entity.getCreatedTime());
} }
if (entity.getSysVersion() != null){ if (entity.getModifier() != null) {
model.setSysVersion(entity.getSysVersion()); model.setModifier(entity.getModifier());
} }
BizLongTextSummaryCacheModel saveModel = this.repository.save(model); if (entity.getModifiedTime() != null) {
model.setModifiedTime(entity.getModifiedTime());
}
if (entity.getSysVersion() != null) {
model.setSysVersion(entity.getSysVersion());
}
BizLongTextSummaryCacheModel saveModel = this.repository.save(model);
return BizLongTextSummaryCacheConvert.modelToEntity(saveModel); return BizLongTextSummaryCacheConvert.modelToEntity(saveModel);
} }
public void deletedById(java.lang.Long id) throws Exception{ public void deletedById(java.lang.Long id) throws Exception {
Assert.notNull(id); Assert.notNull(id);
BizLongTextSummaryCacheModel model = this.repository.get(id); BizLongTextSummaryCacheModel model = this.repository.get(id);
if (model != null){ if (model != null) {
if ("N".equals(model.getIsDeleted())){ if ("N".equals(model.getIsDeleted())) {
model.setIsDeleted("Y"); model.setIsDeleted("Y");
this.repository.save(model); this.repository.save(model);
} }
} }
} }
} }
\ No newline at end of file
...@@ -70,19 +70,15 @@ public class KeyWordAnalyzer extends MeetingContentAnalysisAbstract<List<String> ...@@ -70,19 +70,15 @@ public class KeyWordAnalyzer extends MeetingContentAnalysisAbstract<List<String>
double progress = ((double) (i + 1) / segmentationResultList.size()) * 100D; double progress = ((double) (i + 1) / segmentationResultList.size()) * 100D;
logger.info("-------------关键词提取进度 {} %--------------", progress); logger.info("-------------关键词提取进度 {} %--------------", progress);
} }
int start = generateContent.lastIndexOf("[");
int end = generateContent.lastIndexOf("]");
List<String> res = JsonUtils.deSerialize(generateContent.substring(start, end + 1), new TypeReference<List<String>>() {
}.getType());
return res;
} catch (Exception e) { } catch (Exception e) {
logger.error("关键词提取失败", e); logger.error("关键词提取失败", e);
return Collections.emptyList(); return Collections.emptyList();
} }
if (StringUtils.isBlank(generateContent)) {
return Collections.emptyList();
}
// 转换格式 json to list
int start = generateContent.lastIndexOf("[");
int end = generateContent.lastIndexOf("]");
List<String> res = JsonUtils.deSerialize(generateContent.substring(start, end + 1), new TypeReference<List<String>>() {
}.getType());
return res;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment