Commit c76eff3c authored by alex yao's avatar alex yao

feat(Longtext): 长文档对话接口

parent 4d197a7d
......@@ -365,11 +365,6 @@
<version>1.12</version>
</dependency>
<dependency>
<groupId>aspose-words</groupId>
<artifactId>words</artifactId>
<version>21.1</version>
</dependency>
</dependencies>
......
......@@ -279,7 +279,7 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
agentUseModifyEventInfo.setAgentId(agentId);
agentUseModifyEventInfo.setIsPublish(CommonConstant.IsDeleted.N);
reduceSn = memberEquityService.reducePoint(userBaseEntity.getUserId(), pointDeductionNum, ModifyEventEnum.use, agentUseModifyEventInfo);
//todo
//调用应用服务
agentApplicationService.callAgentApplication(agentId, dialogueId, model,
......
package cn.com.poc.common.model;
import cn.com.yict.framemax.data.model.BaseModelClass;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.io.Serializable;
/**
* Model class for biz_file_upload_record
* 文件上传记录
*/
@Entity
@Table(name = "biz_file_upload_record")
@DynamicInsert
@DynamicUpdate
public class BizFileUploadRecordModel extends BaseModelClass implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
* 主键
*/
private Long id;
@Column(name = "id", length = 19)
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
super.addValidField("id");
}
/**
* file_name
* 文件名
*/
private String fileName;
@Column(name = "file_name", length = 150)
public String getFileName() {
return this.fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
super.addValidField("fileName");
}
/**
* file_url
* 上传地址
*/
private String fileUrl;
@Column(name = "file_url", length = 150)
public String getFileUrl() {
return this.fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
super.addValidField("fileUrl");
}
/**
* cover_sheet_url
* 封面图地址
*/
private String coverSheetUrl;
@Column(name = "cover_sheet_url", length = 150)
public String getCoverSheetUrl() {
return this.coverSheetUrl;
}
public void setCoverSheetUrl(String coverSheetUrl) {
this.coverSheetUrl = coverSheetUrl;
super.addValidField("coverSheetUrl");
}
}
\ No newline at end of file
package cn.com.poc.common.repository;
import cn.com.poc.common.model.BizFileUploadRecordModel;
import cn.com.yict.framemax.data.repository.Repository;
public interface BizFileUploadRecordRepository extends Repository<BizFileUploadRecordModel, Long> {
}
\ No newline at end of file
package cn.com.poc.common.rest.impl;
import cn.com.poc.common.model.BizFileUploadRecordModel;
import cn.com.poc.common.rest.BosRest;
import cn.com.poc.common.service.BizFileUploadRecordService;
import cn.com.poc.common.service.BosConfigService;
import cn.com.poc.common.utils.Assert;
import org.springframework.stereotype.Component;
......@@ -15,12 +17,23 @@ public class BosRestImpl implements BosRest {
@Resource
private BosConfigService bosConfigService;
@Resource
private BizFileUploadRecordService bizFileUploadRecordService;
@Override
public String upload(MultipartFile file) throws IOException {
Assert.notNull(file);
String contentType = file.getContentType();
String originalFilename = file.getOriginalFilename();
String prefix = originalFilename.substring(originalFilename.lastIndexOf(".")).replaceAll("\\.", "");
return bosConfigService.upload(file.getInputStream(), prefix, contentType);
String upload = bosConfigService.upload(file.getInputStream(), prefix, contentType);
BizFileUploadRecordModel bizFileUploadRecordModel = new BizFileUploadRecordModel();
bizFileUploadRecordModel.setFileName(file.getOriginalFilename());
bizFileUploadRecordModel.setFileUrl(upload);
bizFileUploadRecordModel.setCoverSheetUrl("");
bizFileUploadRecordService.save(bizFileUploadRecordModel);
return upload;
}
}
package cn.com.poc.common.service;
import cn.com.poc.common.model.BizFileUploadRecordModel;
import cn.com.yict.framemax.core.service.BaseService;
import cn.com.yict.framemax.data.model.PagingInfo;
import java.util.Collection;
import java.util.List;
public interface BizFileUploadRecordService extends BaseService {
BizFileUploadRecordModel get(Long id) throws Exception;
List<BizFileUploadRecordModel> findByExample(BizFileUploadRecordModel example,PagingInfo pagingInfo) throws Exception;
void delete(BizFileUploadRecordModel model) throws Exception;
void deleteById(Long id) throws Exception;
void deleteAll(Collection<Long> ids) throws Exception;
BizFileUploadRecordModel save(BizFileUploadRecordModel model) ;
Collection<BizFileUploadRecordModel> saveAll(Collection<BizFileUploadRecordModel> models) throws Exception;
}
\ No newline at end of file
package cn.com.poc.common.service.impl;
import cn.com.poc.common.model.BizFileUploadRecordModel;
import cn.com.poc.common.repository.BizFileUploadRecordRepository;
import cn.com.poc.common.service.BizFileUploadRecordService;
import cn.com.yict.framemax.core.service.impl.BaseServiceImpl;
import cn.com.yict.framemax.data.model.PagingInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
@Service
public class BizFileUploadRecordServiceImpl extends BaseServiceImpl
implements BizFileUploadRecordService {
@Resource
private BizFileUploadRecordRepository repository;
public BizFileUploadRecordModel get(Long id) throws Exception{
return this.repository.get(id);
}
public List<BizFileUploadRecordModel> findByExample(BizFileUploadRecordModel example,PagingInfo pagingInfo) throws Exception{
if(example == null){
example = new BizFileUploadRecordModel();
}
return this.repository.findByExample(example,pagingInfo);
}
public void delete(BizFileUploadRecordModel model) throws Exception{
this.repository.remove(model);
}
public void deleteById(Long id) throws Exception{
this.repository.removeByPk(id);
}
public void deleteAll(Collection<Long> ids) throws Exception{
this.repository.removeAllByPk(ids);
}
public BizFileUploadRecordModel save(BizFileUploadRecordModel model) {
return this.repository.save(model);
}
public Collection<BizFileUploadRecordModel> saveAll(Collection<BizFileUploadRecordModel> models) throws Exception{
return this.repository.saveAll(models);
}
}
\ No newline at end of file
......@@ -3,7 +3,6 @@ package cn.com.poc.common.utils;
import cn.com.yict.framemax.core.i18n.I18nMessageException;
import cn.hutool.core.io.FileUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.read.builder.ExcelReaderBuilder;
import io.github.furstenheim.*;
import org.apache.pdfbox.io.RandomAccessBufferedFileInputStream;
import org.apache.pdfbox.pdfparser.PDFParser;
......@@ -14,13 +13,8 @@ import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hwpf.extractor.WordExtractor;
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
import org.apache.poi.sl.extractor.SlideShowExtractor;
import org.apache.poi.sl.usermodel.Slide;
import org.apache.poi.sl.usermodel.SlideShow;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFSlide;
import org.apache.poi.xslf.usermodel.XSLFTextShape;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.jsoup.Jsoup;
......@@ -31,20 +25,23 @@ import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph;
import org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape;
import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
import org.openxmlformats.schemas.presentationml.x2006.main.CTSlide;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.Assert;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.nio.file.Files;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
public class DocumentLoad {
final static OptionsBuilder optionsBuilder = OptionsBuilder.anOptions();
final static Options options = optionsBuilder.withBr("-")
private final static Logger logger = LoggerFactory.getLogger(DocumentLoad.class);
private final static OptionsBuilder optionsBuilder = OptionsBuilder.anOptions();
private final static Options options = optionsBuilder.withBr("-")
.withLinkStyle(LinkStyle.REFERENCED)
.withLinkReferenceStyle(LinkReferenceStyle.SHORTCUT)
.build();
......@@ -272,6 +269,7 @@ public class DocumentLoad {
fs.close();
return tempFile;
} catch (IOException e) {
logger.error("downloadURLDocument error", e);
throw new I18nMessageException("exception/file.load.error");
}
}
......
......@@ -2,6 +2,8 @@ package cn.com.poc.common.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
......@@ -19,6 +21,16 @@ public class SSEUtil {
private final ServletOutputStream outputStream;
public SSEUtil() throws IOException {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletResponse response = servletRequestAttributes.getResponse();
if (response == null) {
throw new IOException("无法获取HttpServletResponse");
}
response.setContentType("text/event-stream;charset=UTF-8");
outputStream = response.getOutputStream();
}
public SSEUtil(HttpServletResponse response) throws IOException {
response.setContentType("text/event-stream;charset=UTF-8");
outputStream = response.getOutputStream();
......
......@@ -73,7 +73,7 @@ public interface KnowledgeRest extends BaseRest {
* @return
* @throws Exception
*/
List<BizKnowledgeDocumentDto> getKdIdsByKnowledgeInfoId(@RequestParam Integer knowledgeInfoId) throws Exception;
List<BizKnowledgeDocumentDto> getKdIdsByKnowledgeInfoId(@RequestParam Integer knowledgeInfoId);
/**
* 获取知识库的文档列表
......@@ -87,7 +87,7 @@ public interface KnowledgeRest extends BaseRest {
/**
* 获取知识库详情
*/
BizKnowledgeInfoDto getKnowledgeDetail(@RequestParam Integer knowledgeInfoId) throws Exception;
BizKnowledgeInfoDto getKnowledgeDetail(@RequestParam Integer knowledgeInfoId) ;
/**
* 获取用户知识库列表
......
......@@ -119,7 +119,7 @@ public class KnowledgeRestImpl implements KnowledgeRest {
}
@Override
public List<BizKnowledgeDocumentDto> searchDocuments(String search, String trainStatus, Integer knowledgeInfoId, PagingInfo pagingInfo) throws Exception {
public List<BizKnowledgeDocumentDto> searchDocuments(String search, String trainStatus, Integer knowledgeInfoId, PagingInfo pagingInfo) {
Assert.notNull(knowledgeInfoId);
List<BizKnowledgeDocumentDto> result = new ArrayList<>();
BizKnowledgeInfoEntity bizKnowledgeInfoEntity = bizKnowledgeInfoService.get(knowledgeInfoId);
......@@ -151,7 +151,7 @@ public class KnowledgeRestImpl implements KnowledgeRest {
}
@Override
public List<BizKnowledgeDocumentDto> getKdIdsByKnowledgeInfoId(Integer knowledgeInfoId) throws Exception {
public List<BizKnowledgeDocumentDto> getKdIdsByKnowledgeInfoId(Integer knowledgeInfoId) {
Assert.notNull(knowledgeInfoId);
BizKnowledgeInfoEntity bizKnowledgeInfoEntity = bizKnowledgeInfoService.get(knowledgeInfoId);
if (bizKnowledgeInfoEntity == null) {
......@@ -195,7 +195,7 @@ public class KnowledgeRestImpl implements KnowledgeRest {
}
@Override
public BizKnowledgeInfoDto getKnowledgeDetail(Integer knowledgeInfoId) throws Exception {
public BizKnowledgeInfoDto getKnowledgeDetail(Integer knowledgeInfoId) {
Assert.notNull(knowledgeInfoId);
BizKnowledgeInfoEntity bizKnowledgeInfoEntity = bizKnowledgeInfoService.get(knowledgeInfoId);
return BizKnowledgeInfoConvert.entityToDto(bizKnowledgeInfoEntity);
......
package cn.com.poc.long_document.aggregate;
import cn.com.poc.long_document.dto.DialoguesContextDto;
import cn.com.poc.long_document.dto.LongTextDialoguesDto;
import cn.com.poc.long_document.dto.LongTextExampleDto;
import java.util.List;
/**
* @author alex.yao
* @date 2025/6/17
*/
public interface LongTextDialoguesService {
String create(String fileUrl, Long userId) throws Exception;
void call(String dialoguesId, String fileUrl, String input, Integer[] knowledgeIds, Long userId) throws Exception;
void delete(String dialoguesId, Long userId) throws Exception;
List<LongTextDialoguesDto> dialoguesList(Long userId) throws Exception;
List<DialoguesContextDto> dialoguesContext(String dialoguesId, Long userId) throws Exception;
List<LongTextExampleDto> example() throws Exception;
}
package cn.com.poc.long_document.domain;
/**
* @author alex.yao
* @date 2025/6/3
*/
public class LongtextDialoguesResult {
private String message;
private String reasoningContent;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getReasoningContent() {
return reasoningContent;
}
public void setReasoningContent(String reasoningContent) {
this.reasoningContent = reasoningContent;
}
}
package cn.com.poc.long_document.dto;
/**
* @author alex.yao
* @date 2025/6/3
*/
public class CreateDialoguesDto {
private String fileUrl;
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
}
package cn.com.poc.long_document.dto;
/**
* @author alex.yao
* @date 2025/6/3
*/
public class DialoguesContextDto {
private String role;
private String content;
private String reasoningContent;
private long timestamp;
private String fileUrl;
private String fileName;
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getReasoningContent() {
return reasoningContent;
}
public void setReasoningContent(String reasoningContent) {
this.reasoningContent = reasoningContent;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
}
package cn.com.poc.long_document.dto;
import java.util.List;
/**
* @author alex.yao
* @date 2025/6/3
*/
public class LongTextDialoguesCallDto {
/**
* 对话id
*/
private String dialoguesId;
/**
* 文件地址
*/
private String fileUrl;
/**
* 输入内容
*/
private String input;
/**
* 知识库id
*/
private Integer[] knowledgeIds;
public String getDialoguesId() {
return dialoguesId;
}
public void setDialoguesId(String dialoguesId) {
this.dialoguesId = dialoguesId;
}
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
public String getInput() {
return input;
}
public void setInput(String input) {
this.input = input;
}
public Integer[] getKnowledgeIds() {
return knowledgeIds;
}
public void setKnowledgeIds(Integer[] knowledgeIds) {
this.knowledgeIds = knowledgeIds;
}
}
package cn.com.poc.long_document.dto;
import java.util.Date;
/**
* @author alex.yao
* @date 2025/6/3
*/
public class LongTextDialoguesDto {
/**
* 标题
*/
private String title;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
/**
* dialogs_id
* 对话id
*/
private String dialogsId;
public String getDialogsId() {
return this.dialogsId;
}
public void setDialogsId(String dialogsId) {
this.dialogsId = dialogsId;
}
/**
* member_id
* 用户
*/
private Long memberId;
public Long getMemberId() {
return this.memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
}
/**
* file_url
* 文件地址
*/
private String fileUrl;
public String getFileUrl() {
return this.fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
/**
* fileName
* 文件名
*/
private String fileName;
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
/**
* 创建时间
*/
private Date createdTime;
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
/**
* 内容简介
*/
private String summary;
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
}
package cn.com.poc.long_document.dto;
/**
* @author alex.yao
* @date 2025/6/3
*/
public class LongTextExampleDto {
private String title;
private String fileUrl;
private String description;
private String question;
private String fileName;
private String previewImage;
public String getPreviewImage() {
return previewImage;
}
public void setPreviewImage(String previewImage) {
this.previewImage = previewImage;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
package cn.com.poc.long_document.model;
import cn.com.yict.framemax.data.model.BaseModelClass;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.io.Serializable;
/**
* Model class for biz_long_text_dialogues
* 长文文档
*/
@Entity
@Table(name = "biz_long_text_dialogues")
@DynamicInsert
@DynamicUpdate
public class BizLongTextDialoguesModel extends BaseModelClass implements Serializable {
private static final long serialVersionUID = 1L;
/** id
*
*/
private Long id;
@Column(name = "id",length = 19)
@Id @GeneratedValue(strategy = GenerationType.AUTO)
public Long getId(){
return this.id;
}
public void setId(Long id){
this.id = id;
super.addValidField("id");
}
/** title
*title
*/
private String title;
@Column(name = "title",length = 150)
public String getTitle(){
return this.title;
}
public void setTitle(String title){
this.title = title;
super.addValidField("title");
}
/** dialogs_id
*对话id
*/
private String dialogsId;
@Column(name = "dialogs_id",length = 100)
public String getDialogsId(){
return this.dialogsId;
}
public void setDialogsId(String dialogsId){
this.dialogsId = dialogsId;
super.addValidField("dialogsId");
}
/** member_id
*用户
*/
private Long memberId;
@Column(name = "member_id",length = 100)
public Long getMemberId(){
return this.memberId;
}
public void setMemberId(Long memberId){
this.memberId = memberId;
super.addValidField("memberId");
}
/** file_url
*文件地址
*/
private String fileUrl;
@Column(name = "file_url",length = 150)
public String getFileUrl(){
return this.fileUrl;
}
public void setFileUrl(String fileUrl){
this.fileUrl = fileUrl;
super.addValidField("fileUrl");
}
/** is_deleted
*是否删除 1、Y 是 2、N 否
*/
private String isDeleted;
@Column(name = "is_deleted",length = 1)
public String getIsDeleted(){
return this.isDeleted;
}
public void setIsDeleted(String isDeleted){
this.isDeleted = isDeleted;
super.addValidField("isDeleted");
}
/** CREATOR
*创建人
*/
private String creator;
@Column(name = "CREATOR",length = 225)
public String getCreator(){
return this.creator;
}
public void setCreator(String creator){
this.creator = creator;
super.addValidField("creator");
}
/** CREATED_TIME
*创建时间
*/
private java.util.Date createdTime;
@Column(name = "CREATED_TIME",length = 19)
public java.util.Date getCreatedTime(){
return this.createdTime;
}
public void setCreatedTime(java.util.Date createdTime){
this.createdTime = createdTime;
super.addValidField("createdTime");
}
/** MODIFIER
*修改人
*/
private String modifier;
@Column(name = "MODIFIER",length = 225)
public String getModifier(){
return this.modifier;
}
public void setModifier(String modifier){
this.modifier = modifier;
super.addValidField("modifier");
}
/** MODIFIED_TIME
*修改时间
*/
private java.util.Date modifiedTime;
@Column(name = "MODIFIED_TIME",length = 19)
public java.util.Date getModifiedTime(){
return this.modifiedTime;
}
public void setModifiedTime(java.util.Date modifiedTime){
this.modifiedTime = modifiedTime;
super.addValidField("modifiedTime");
}
/** SYS_VERSION
*乐观锁,版本号
*/
private Integer sysVersion;
@Column(name = "SYS_VERSION",length = 10)
@Version
public Integer getSysVersion(){
return this.sysVersion;
}
public void setSysVersion(Integer sysVersion){
this.sysVersion = sysVersion;
super.addValidField("sysVersion");
}
}
\ No newline at end of file
package cn.com.poc.long_document.model;
import cn.com.yict.framemax.data.model.BaseModelClass;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.io.Serializable;
/**
* Model class for biz_long_text_dialogues_record
* 长文文档-用户对话记录
*/
@Entity
@Table(name = "biz_long_text_dialogues_record")
@DynamicInsert
@DynamicUpdate
public class BizLongTextDialoguesRecordModel extends BaseModelClass implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
* 主键ID
*/
private Long id;
@Column(name = "id", length = 19)
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
super.addValidField("id");
}
/**
* role
* 角色 user-用户 assistant-助手
*/
private String role;
@Column(name = "role", length = 100)
public String getRole() {
return this.role;
}
public void setRole(String role) {
this.role = role;
super.addValidField("role");
}
/**
* dialogs_id
* 会话ID
*/
private String dialogsId;
@Column(name = "dialogs_id", length = 100)
public String getDialogsId() {
return this.dialogsId;
}
public void setDialogsId(String dialogsId) {
this.dialogsId = dialogsId;
super.addValidField("dialogsId");
}
/**
* member_id
* 用户ID
*/
private Long memberId;
@Column(name = "member_id", length = 19)
public Long getMemberId() {
return this.memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
super.addValidField("memberId");
}
/**
* content
* 内容
*/
private String content;
@Column(name = "content", length = 2147483647)
public String getContent() {
return this.content;
}
public void setContent(String content) {
this.content = content;
super.addValidField("content");
}
/**
* reasoning_content
* 推理内容
*/
private String reasoningContent;
@Column(name = "reasoning_content", length = 2147483647)
public String getReasoningContent() {
return this.reasoningContent;
}
public void setReasoningContent(String reasoningContent) {
this.reasoningContent = reasoningContent;
super.addValidField("reasoningContent");
}
/**
* fileUrl
* 文件
*/
private String fileUrl;
@Column(name = "file_url", length = 150)
public String getFileUrl() {
return this.fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
super.addValidField("fileUrl");
}
/**
* timestamp
* 时间戳
*/
private Long timestamp;
@Column(name = "timestamp", length = 19)
public Long getTimestamp() {
return this.timestamp;
}
public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
super.addValidField("timestamp");
}
/**
* is_deleted
* 是否删除 1、Y 是 2、N 否
*/
private String isDeleted;
@Column(name = "is_deleted", length = 1)
public String getIsDeleted() {
return this.isDeleted;
}
public void setIsDeleted(String isDeleted) {
this.isDeleted = isDeleted;
super.addValidField("isDeleted");
}
/**
* CREATOR
* 创建人
*/
private String creator;
@Column(name = "CREATOR", length = 225)
public String getCreator() {
return this.creator;
}
public void setCreator(String creator) {
this.creator = creator;
super.addValidField("creator");
}
/**
* CREATED_TIME
* 创建时间
*/
private java.util.Date createdTime;
@Column(name = "CREATED_TIME", length = 19)
public java.util.Date getCreatedTime() {
return this.createdTime;
}
public void setCreatedTime(java.util.Date createdTime) {
this.createdTime = createdTime;
super.addValidField("createdTime");
}
/**
* MODIFIER
* 修改人
*/
private String modifier;
@Column(name = "MODIFIER", length = 225)
public String getModifier() {
return this.modifier;
}
public void setModifier(String modifier) {
this.modifier = modifier;
super.addValidField("modifier");
}
/**
* MODIFIED_TIME
* 修改时间
*/
private java.util.Date modifiedTime;
@Column(name = "MODIFIED_TIME", length = 19)
public java.util.Date getModifiedTime() {
return this.modifiedTime;
}
public void setModifiedTime(java.util.Date modifiedTime) {
this.modifiedTime = modifiedTime;
super.addValidField("modifiedTime");
}
/**
* SYS_VERSION
* 乐观锁,版本号
*/
private Integer sysVersion;
@Column(name = "SYS_VERSION", length = 10)
@Version
public Integer getSysVersion() {
return this.sysVersion;
}
public void setSysVersion(Integer sysVersion) {
this.sysVersion = sysVersion;
super.addValidField("sysVersion");
}
}
\ No newline at end of file
package cn.com.poc.long_document.model;
import cn.com.yict.framemax.data.model.BaseModelClass;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.io.Serializable;
/**
* Model class for biz_long_text_example
* 长文文档-例子
*/
@Entity
@Table(name = "biz_long_text_example")
@DynamicInsert
@DynamicUpdate
public class BizLongTextExampleModel extends BaseModelClass implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private Integer id;
@Column(name = "id", length = 10)
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
super.addValidField("id");
}
/**
* title
*/
private String title;
@Column(name = "title", length = 100)
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
super.addValidField("title");
}
/**
* file_url
*/
private String fileUrl;
@Column(name = "file_url", length = 150)
public String getFileUrl() {
return this.fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
super.addValidField("fileUrl");
}
/**
* preview_image
*/
private String previewImage;
@Column(name = "preview_image", length = 150)
public String getPreviewImage() {
return this.previewImage;
}
public void setPreviewImage(String previewImage) {
this.previewImage = previewImage;
super.addValidField("previewImage");
}
/**
* description
*/
private String description;
@Column(name = "description", length = 150)
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
super.addValidField("description");
}
/**
* question
*/
private String question;
@Column(name = "question", length = 100)
public String getQuestion() {
return this.question;
}
public void setQuestion(String question) {
this.question = question;
super.addValidField("question");
}
/**
* is_deleted
* 是否删除 1、Y 是 2、N 否
*/
private String isDeleted;
@Column(name = "is_deleted", length = 1)
public String getIsDeleted() {
return this.isDeleted;
}
public void setIsDeleted(String isDeleted) {
this.isDeleted = isDeleted;
super.addValidField("isDeleted");
}
/**
* CREATOR
* 创建人
*/
private String creator;
@Column(name = "CREATOR", length = 225)
public String getCreator() {
return this.creator;
}
public void setCreator(String creator) {
this.creator = creator;
super.addValidField("creator");
}
/**
* CREATED_TIME
* 创建时间
*/
private java.util.Date createdTime;
@Column(name = "CREATED_TIME", length = 19)
public java.util.Date getCreatedTime() {
return this.createdTime;
}
public void setCreatedTime(java.util.Date createdTime) {
this.createdTime = createdTime;
super.addValidField("createdTime");
}
/**
* MODIFIER
* 修改人
*/
private String modifier;
@Column(name = "MODIFIER", length = 225)
public String getModifier() {
return this.modifier;
}
public void setModifier(String modifier) {
this.modifier = modifier;
super.addValidField("modifier");
}
/**
* MODIFIED_TIME
* 修改时间
*/
private java.util.Date modifiedTime;
@Column(name = "MODIFIED_TIME", length = 19)
public java.util.Date getModifiedTime() {
return this.modifiedTime;
}
public void setModifiedTime(java.util.Date modifiedTime) {
this.modifiedTime = modifiedTime;
super.addValidField("modifiedTime");
}
/**
* SYS_VERSION
* 乐观锁,版本号
*/
private Integer sysVersion;
@Column(name = "SYS_VERSION", length = 10)
@Version
public Integer getSysVersion() {
return this.sysVersion;
}
public void setSysVersion(Integer sysVersion) {
this.sysVersion = sysVersion;
super.addValidField("sysVersion");
}
}
\ No newline at end of file
package cn.com.poc.long_document.repository;
import cn.com.poc.long_document.model.BizLongTextDialoguesRecordModel;
import cn.com.yict.framemax.data.repository.Repository;
public interface BizLongTextDialoguesRecordRepository extends Repository<BizLongTextDialoguesRecordModel, Long> {
}
\ No newline at end of file
package cn.com.poc.long_document.repository;
import cn.com.poc.long_document.model.BizLongTextDialoguesModel;
import cn.com.yict.framemax.data.repository.Repository;
public interface BizLongTextDialoguesRepository extends Repository<BizLongTextDialoguesModel, Long> {
}
\ No newline at end of file
package cn.com.poc.long_document.repository;
import cn.com.poc.long_document.model.BizLongTextExampleModel;
import cn.com.yict.framemax.data.repository.Repository;
public interface BizLongTextExampleRepository extends Repository<BizLongTextExampleModel, Integer> {
}
\ No newline at end of file
package cn.com.poc.long_document.rest;
import cn.com.poc.long_document.dto.*;
import cn.com.yict.framemax.core.rest.BaseRest;
import cn.com.yict.framemax.web.permission.Access;
import cn.com.yict.framemax.web.permission.Permission;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 长文档对话接口
*
* @author alex.yao
* @date 2025/6/3
*/
@Permission(Access.Safety)
public interface LongTextDialoguesRest extends BaseRest {
/**
* 创建对话
*
* @return
* @throws Exception
*/
String create(@RequestBody CreateDialoguesDto dto) throws Exception;
/**
* 对话调用
*
* @param dto
* @throws Exception
*/
void call(@RequestBody LongTextDialoguesCallDto dto) throws Exception;
/**
* 删除对话
*
* @param dialoguesId
* @throws Exception
*/
void delete(@RequestParam String dialoguesId) throws Exception;
/**
* 对话列表
*
* @return
* @throws Exception
*/
List<LongTextDialoguesDto> dialoguesList() throws Exception;
/**
* 对话上下文
*
* @param dialoguesId
* @return
* @throws Exception
*/
List<DialoguesContextDto> dialoguesContext(@RequestParam String dialoguesId) throws Exception;
/**
* 示例
*
* @return
* @throws Exception
*/
List<LongTextExampleDto> example() throws Exception;
}
package cn.com.poc.long_document.rest.impl;
import cn.com.poc.common.utils.Assert;
import cn.com.poc.common.utils.BlContext;
import cn.com.poc.long_document.aggregate.LongTextDialoguesService;
import cn.com.poc.long_document.dto.*;
import cn.com.poc.long_document.rest.LongTextDialoguesRest;
import cn.com.poc.support.security.oauth.entity.UserBaseEntity;
import cn.com.yict.framemax.core.exception.BusinessException;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
/**
* @author alex.yao
* @date 2025/6/3
*/
@Component
public class LongTextDialoguesRestImpl implements LongTextDialoguesRest {
@Resource
private LongTextDialoguesService longTextDialoguesService;
@Override
public String create(CreateDialoguesDto dto) throws Exception {
Assert.notNull(dto.getFileUrl(), "文件URL不能为空");
UserBaseEntity userBaseEntity = BlContext.getCurrentUserNotException();
if (userBaseEntity == null) {
throw new BusinessException("用户未登录");
}
return longTextDialoguesService.create(dto.getFileUrl(), userBaseEntity.getUserId());
}
@Override
public void call(LongTextDialoguesCallDto dto) throws Exception {
Assert.notBlank(dto.getDialoguesId(), "对话ID不能为空");
Assert.notBlank(dto.getInput(), "输入内容不能为空");
UserBaseEntity userBaseEntity = BlContext.getCurrentUserNotException();
if (userBaseEntity == null) {
throw new BusinessException("用户未登录");
}
longTextDialoguesService.call(dto.getDialoguesId(),
dto.getFileUrl(),
dto.getInput(),
dto.getKnowledgeIds(),
userBaseEntity.getUserId());
}
@Override
public void delete(String dialoguesId) throws Exception {
Assert.notBlank(dialoguesId, "对话ID不能为空");
UserBaseEntity userBaseEntity = BlContext.getCurrentUserNotException();
if (userBaseEntity == null) {
throw new BusinessException("用户未登录");
}
longTextDialoguesService.delete(dialoguesId, userBaseEntity.getUserId());
}
@Override
public List<LongTextDialoguesDto> dialoguesList() throws Exception {
UserBaseEntity userBaseEntity = BlContext.getCurrentUserNotException();
if (userBaseEntity == null) {
throw new BusinessException("用户未登录");
}
return longTextDialoguesService.dialoguesList(userBaseEntity.getUserId());
}
@Override
public List<DialoguesContextDto> dialoguesContext(String dialoguesId) throws Exception {
Assert.notBlank(dialoguesId, "对话ID不能为空");
UserBaseEntity userBaseEntity = BlContext.getCurrentUserNotException();
if (userBaseEntity == null) {
throw new BusinessException("用户未登录");
}
return longTextDialoguesService.dialoguesContext(dialoguesId, userBaseEntity.getUserId());
}
@Override
public List<LongTextExampleDto> example() throws Exception {
return longTextDialoguesService.example();
}
}
package cn.com.poc.long_document.service;
import cn.com.poc.long_document.model.BizLongTextDialoguesRecordModel;
import cn.com.yict.framemax.core.service.BaseService;
import cn.com.yict.framemax.data.model.PagingInfo;
import java.util.Collection;
import java.util.List;
public interface BizLongTextDialoguesRecordService extends BaseService {
BizLongTextDialoguesRecordModel get(Long id) throws Exception;
List<BizLongTextDialoguesRecordModel> findByExample(BizLongTextDialoguesRecordModel example,PagingInfo pagingInfo) throws Exception;
void delete(BizLongTextDialoguesRecordModel model) throws Exception;
void deleteById(Long id) throws Exception;
void deleteAll(Collection<Long> ids) throws Exception;
BizLongTextDialoguesRecordModel save(BizLongTextDialoguesRecordModel model) throws Exception;
Collection<BizLongTextDialoguesRecordModel> saveAll(Collection<BizLongTextDialoguesRecordModel> models) throws Exception;
}
\ No newline at end of file
package cn.com.poc.long_document.service;
import cn.com.poc.long_document.model.BizLongTextDialoguesModel;
import cn.com.yict.framemax.core.service.BaseService;
import cn.com.yict.framemax.data.model.PagingInfo;
import java.util.Collection;
import java.util.List;
public interface BizLongTextDialoguesService extends BaseService {
BizLongTextDialoguesModel get(Long id) throws Exception;
List<BizLongTextDialoguesModel> findByExample(BizLongTextDialoguesModel example,PagingInfo pagingInfo) throws Exception;
void delete(BizLongTextDialoguesModel model) throws Exception;
void deleteById(Long id) throws Exception;
void deleteAll(Collection<Long> ids) throws Exception;
BizLongTextDialoguesModel save(BizLongTextDialoguesModel model) throws Exception;
Collection<BizLongTextDialoguesModel> saveAll(Collection<BizLongTextDialoguesModel> models) throws Exception;
}
\ No newline at end of file
package cn.com.poc.long_document.service;
import cn.com.poc.long_document.model.BizLongTextExampleModel;
import cn.com.yict.framemax.core.service.BaseService;
import cn.com.yict.framemax.data.model.PagingInfo;
import java.util.Collection;
import java.util.List;
public interface BizLongTextExampleService extends BaseService {
BizLongTextExampleModel get(Integer id) throws Exception;
Collection<BizLongTextExampleModel> findByExample(BizLongTextExampleModel example,PagingInfo pagingInfo) throws Exception;
void delete(BizLongTextExampleModel model) throws Exception;
void deleteById(Integer id) throws Exception;
void deleteAll(Collection<Integer> ids) throws Exception;
BizLongTextExampleModel save(BizLongTextExampleModel model) throws Exception;
Collection<BizLongTextExampleModel> saveAll(Collection<BizLongTextExampleModel> models) throws Exception;
}
\ No newline at end of file
package cn.com.poc.long_document.service.impl;
import cn.com.poc.long_document.model.BizLongTextDialoguesRecordModel;
import cn.com.poc.long_document.repository.BizLongTextDialoguesRecordRepository;
import cn.com.poc.long_document.service.BizLongTextDialoguesRecordService;
import cn.com.yict.framemax.core.service.impl.BaseServiceImpl;
import cn.com.yict.framemax.data.model.PagingInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
@Service
public class BizLongTextDialoguesRecordServiceImpl extends BaseServiceImpl
implements BizLongTextDialoguesRecordService {
@Resource
private BizLongTextDialoguesRecordRepository repository;
public BizLongTextDialoguesRecordModel get(Long id) throws Exception{
return this.repository.get(id);
}
public List<BizLongTextDialoguesRecordModel> findByExample(BizLongTextDialoguesRecordModel example,PagingInfo pagingInfo) throws Exception{
if(example == null){
example = new BizLongTextDialoguesRecordModel();
}
return this.repository.findByExample(example,pagingInfo);
}
public void delete(BizLongTextDialoguesRecordModel model) throws Exception{
this.repository.remove(model);
}
public void deleteById(Long id) throws Exception{
this.repository.removeByPk(id);
}
public void deleteAll(Collection<Long> ids) throws Exception{
this.repository.removeAllByPk(ids);
}
public BizLongTextDialoguesRecordModel save(BizLongTextDialoguesRecordModel model) throws Exception{
return this.repository.save(model);
}
public Collection<BizLongTextDialoguesRecordModel> saveAll(Collection<BizLongTextDialoguesRecordModel> models) throws Exception{
return this.repository.saveAll(models);
}
}
\ No newline at end of file
package cn.com.poc.long_document.service.impl;
import cn.com.poc.long_document.model.BizLongTextDialoguesModel;
import cn.com.poc.long_document.repository.BizLongTextDialoguesRepository;
import cn.com.poc.long_document.service.BizLongTextDialoguesService;
import cn.com.yict.framemax.core.service.impl.BaseServiceImpl;
import cn.com.yict.framemax.data.model.PagingInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
@Service
public class BizLongTextDialoguesServiceImpl extends BaseServiceImpl
implements BizLongTextDialoguesService {
@Resource
private BizLongTextDialoguesRepository repository;
public BizLongTextDialoguesModel get(Long id) throws Exception {
return this.repository.get(id);
}
public List<BizLongTextDialoguesModel> findByExample(BizLongTextDialoguesModel example, PagingInfo pagingInfo) throws Exception {
if (example == null) {
example = new BizLongTextDialoguesModel();
}
return this.repository.findByExample(example, "id desc", pagingInfo);
}
public void delete(BizLongTextDialoguesModel model) throws Exception {
this.repository.remove(model);
}
public void deleteById(Long id) throws Exception {
this.repository.removeByPk(id);
}
public void deleteAll(Collection<Long> ids) throws Exception {
this.repository.removeAllByPk(ids);
}
public BizLongTextDialoguesModel save(BizLongTextDialoguesModel model) throws Exception {
return this.repository.save(model);
}
public Collection<BizLongTextDialoguesModel> saveAll(Collection<BizLongTextDialoguesModel> models) throws Exception {
return this.repository.saveAll(models);
}
}
\ No newline at end of file
package cn.com.poc.long_document.service.impl;
import cn.com.poc.long_document.model.BizLongTextExampleModel;
import cn.com.poc.long_document.repository.BizLongTextExampleRepository;
import cn.com.poc.long_document.service.BizLongTextExampleService;
import cn.com.yict.framemax.core.service.impl.BaseServiceImpl;
import cn.com.yict.framemax.data.model.PagingInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
@Service
public class BizLongTextExampleServiceImpl extends BaseServiceImpl
implements BizLongTextExampleService {
@Resource
private BizLongTextExampleRepository repository;
public BizLongTextExampleModel get(Integer id) throws Exception{
return this.repository.get(id);
}
public Collection<BizLongTextExampleModel> findByExample(BizLongTextExampleModel example,PagingInfo pagingInfo) throws Exception{
if(example == null){
example = new BizLongTextExampleModel();
}
return this.repository.findByExample(example,pagingInfo);
}
public void delete(BizLongTextExampleModel model) throws Exception{
this.repository.remove(model);
}
public void deleteById(Integer id) throws Exception{
this.repository.removeByPk(id);
}
public void deleteAll(Collection<Integer> ids) throws Exception{
this.repository.removeAllByPk(ids);
}
public BizLongTextExampleModel save(BizLongTextExampleModel model) throws Exception{
return this.repository.save(model);
}
public Collection<BizLongTextExampleModel> saveAll(Collection<BizLongTextExampleModel> models) throws Exception{
return this.repository.saveAll(models);
}
}
\ No newline at end of file
......@@ -9,13 +9,7 @@ public class OauthConstants {
public static final String MEMBER_DOMAIN = "/member_platform/";
// public static final String STAFF_DOMAIN = "/staff/";
//
// public static final String OPEN_PLATFORM = "/open_platform/";
//
// public static final String EXPOSE_USER_DOMAIN = "/expose_user/";
//
// public static final String EXPOSE_STAFF_DOMAIN = "/expose_staff/";
public static final String CENTRAL_AUTHENTICATION_DOMAIN = "/gsst_authentication_platform/"; //中央认证平台 - 中台member
}
......@@ -26,6 +20,8 @@ public class OauthConstants {
public static final String MEMBER_DOMAIN = "member_platform";
public static final String CENTRAL_AUTHENTICATION_DOMAIN = "gsst_authentication_platform";
// public static final String STAFF_DOMAIN = "staff";
//
// public static final String OPEN_PLATFORM = "open_platform";
......@@ -41,7 +37,9 @@ public class OauthConstants {
public enum OauthEnum {
MEMBER_DOMAIN(UserType.MEMBER_DOMAIN, "会员");
MEMBER_DOMAIN(UserType.MEMBER_DOMAIN, "会员"),
CENTRAL_AUTHENTICATION(UserType.CENTRAL_AUTHENTICATION_DOMAIN, "中央认证平台"),
// STAFF_DOMAIN(UserType.STAFF_DOMAIN,"员工"),
//
......@@ -53,6 +51,7 @@ public class OauthConstants {
//
// EXPOSE_STAFF_DOMAIN(UserType.EXPOSE_STAFF_DOMAIN,"第三方员工");
;
String userType;
......
......@@ -3,9 +3,9 @@ hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
hibernate.show_sql=true
hibernate.format_sql=true
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://192.168.21.31:3306/gsst_poc_sit?useSSL=false&useUnicode=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai&characterEncoding=UTF-8
jdbc.username=poc_root
jdbc.password=8db58a2836dc
jdbc.url=jdbc:mysql://192.168.21.31:3306/gsst_modellink_sit?useSSL=false&useUnicode=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai&characterEncoding=UTF-8
jdbc.username=modellink_root
jdbc.password=56a6a2854424
ds.maxActive=4
ds.minIdle=1
ds.initialSize=1
......
......@@ -3,9 +3,9 @@ hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
hibernate.show_sql=true
hibernate.format_sql=true
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://192.168.21.31:3306/gsst_poc_prod?useSSL=false&useUnicode=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai&characterEncoding=UTF-8
jdbc.username=poc_root
jdbc.password=8db58a2836dc
jdbc.url=jdbc:mysql://192.168.21.31:3306/gsst_modellink_prod?useSSL=false&useUnicode=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai&characterEncoding=UTF-8
jdbc.username=modellink_root
jdbc.password=56a6a2854424
ds.maxActive=8
ds.minIdle=1
ds.initialSize=1
......
......@@ -3,9 +3,9 @@ hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
hibernate.show_sql=true
hibernate.format_sql=true
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://192.168.21.31:3306/gsst_poc_sit?useSSL=false&useUnicode=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai&characterEncoding=UTF-8
jdbc.username=poc_root
jdbc.password=8db58a2836dc
jdbc.url=jdbc:mysql://192.168.21.31:3306/gsst_modellink_sit?useSSL=false&useUnicode=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai&characterEncoding=UTF-8
jdbc.username=modellink_root
jdbc.password=56a6a2854424
ds.maxActive=20
ds.minIdle=1
ds.initialSize=1
......
......@@ -3,9 +3,9 @@ hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
hibernate.show_sql=true
hibernate.format_sql=true
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://192.168.21.31:3306/gsst_poc_sit?useSSL=false&useUnicode=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai&characterEncoding=UTF-8
jdbc.username=poc_root
jdbc.password=8db58a2836dc
jdbc.url=jdbc:mysql://192.168.21.31:3306/gsst_modellink_prod?useSSL=false&useUnicode=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai&characterEncoding=UTF-8
jdbc.username=modellink_root
jdbc.password=56a6a2854424
ds.maxActive=8
ds.minIdle=1
ds.initialSize=1
......
......@@ -29,22 +29,11 @@ public class FileUtilsTest {
@Test
public void test_wordConvertPDF() throws Exception {
String filePath = "";
File file = FileUtils.wordConvertPDF(new File(filePath));
File pdfFile = new File("C:\\Users\\52747\\Documents\\dataset\\香港正式駕駛執照複本(Chi)—按模板切分.doc");
File file = FileUtils.wordConvertPDF(pdfFile);
System.out.println(DocumentLoad.loadPDF(file));
}
@Test
public void test_word2html() throws Exception {
String filePath = "C:\\Users\\52747\\Desktop\\test_motionDetailExport.docx";
String dataDir = "C:\\Users\\52747\\Desktop\\";
Document doc = new Document(filePath);
HtmlSaveOptions opts = new HtmlSaveOptions(SaveFormat.HTML);
opts.setHtmlVersion(HtmlVersion.HTML_5);
opts.setExportImagesAsBase64(true);
opts.setExportPageMargins(true);
doc.save(dataDir + "TestFile.html", opts);
}
@Test
public void test_pdf2word() {
......
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