mirror of
https://gitcode.com/ageerle/ruoyi-ai.git
synced 2026-03-19 15:43:42 +08:00
refactor: 1. 移除图片附件模块 2. 优化import
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.ruoyi.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.core.domain.BaseEntity;
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
package org.ruoyi.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import org.ruoyi.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 知识库附件图片列对象 knowledge_attach_pic
|
||||
*
|
||||
* @author Albert
|
||||
* @date 2025-05-15
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("knowledge_attach_pic")
|
||||
public class KnowledgeAttachPic extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 知识库id
|
||||
*/
|
||||
private String kid;
|
||||
|
||||
/**
|
||||
* 附件id
|
||||
*/
|
||||
private String aid;
|
||||
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
private String docName;
|
||||
|
||||
/**
|
||||
* 文档类型
|
||||
*/
|
||||
private String docType;
|
||||
|
||||
/**
|
||||
* 文档内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 所在页数
|
||||
*/
|
||||
private Integer pageNum;
|
||||
|
||||
/**
|
||||
* 所在页index
|
||||
*/
|
||||
private Integer indexNum;
|
||||
|
||||
/**
|
||||
* 分析图片状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
private Integer picAnysStatus;
|
||||
|
||||
/**
|
||||
* 对象存储主键
|
||||
*/
|
||||
private Long ossId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.ruoyi.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.core.domain.BaseEntity;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.ruoyi.domain;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.core.domain.BaseEntity;
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package org.ruoyi.domain.bo;
|
||||
|
||||
import org.ruoyi.common.core.validate.AddGroup;
|
||||
import org.ruoyi.common.core.validate.EditGroup;
|
||||
import org.ruoyi.domain.KnowledgeAttach;
|
||||
import org.ruoyi.core.domain.BaseEntity;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.ruoyi.common.core.validate.AddGroup;
|
||||
import org.ruoyi.common.core.validate.EditGroup;
|
||||
import org.ruoyi.core.domain.BaseEntity;
|
||||
import org.ruoyi.domain.KnowledgeAttach;
|
||||
|
||||
/**
|
||||
* 知识库附件业务对象 knowledge_attach
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
package org.ruoyi.domain.bo;
|
||||
|
||||
import org.ruoyi.common.core.validate.AddGroup;
|
||||
import org.ruoyi.common.core.validate.EditGroup;
|
||||
import org.ruoyi.core.domain.BaseEntity;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.ruoyi.domain.KnowledgeAttachPic;
|
||||
|
||||
/**
|
||||
* 知识库附件图片列业务对象 knowledge_attach_pic
|
||||
*
|
||||
* @author Albert
|
||||
* @date 2025-05-15
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = KnowledgeAttachPic.class, reverseConvertGenerate = false)
|
||||
public class KnowledgeAttachPicBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 知识库id
|
||||
*/
|
||||
@NotBlank(message = "知识库id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String kid;
|
||||
|
||||
/**
|
||||
* 附件id
|
||||
*/
|
||||
@NotBlank(message = "附件id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String aid;
|
||||
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
@NotBlank(message = "文档名称不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String docName;
|
||||
|
||||
/**
|
||||
* 文档类型
|
||||
*/
|
||||
@NotBlank(message = "文档类型不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String docType;
|
||||
|
||||
/**
|
||||
* 文档内容
|
||||
*/
|
||||
@NotBlank(message = "文档内容不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 所在页数
|
||||
*/
|
||||
@NotNull(message = "所在页数不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Integer pageNum;
|
||||
|
||||
/**
|
||||
* 所在页index
|
||||
*/
|
||||
@NotNull(message = "所在页index不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Integer indexNum;
|
||||
|
||||
/**
|
||||
* 分析图片状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
@NotNull(message = "分析图片状态10未开始,20进行中,30已完成不能为空", groups = {AddGroup.class,
|
||||
EditGroup.class})
|
||||
private Integer picAnysStatus;
|
||||
|
||||
/**
|
||||
* 对象存储主键
|
||||
*/
|
||||
@NotNull(message = "对象存储主键不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long ossId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@NotBlank(message = "备注不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
package org.ruoyi.domain.bo;
|
||||
|
||||
import org.ruoyi.common.core.validate.AddGroup;
|
||||
import org.ruoyi.common.core.validate.EditGroup;
|
||||
import org.ruoyi.domain.KnowledgeFragment;
|
||||
import org.ruoyi.core.domain.BaseEntity;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.ruoyi.common.core.validate.AddGroup;
|
||||
import org.ruoyi.common.core.validate.EditGroup;
|
||||
import org.ruoyi.core.domain.BaseEntity;
|
||||
import org.ruoyi.domain.KnowledgeFragment;
|
||||
|
||||
/**
|
||||
* 知识片段业务对象 knowledge_fragment
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package org.ruoyi.domain.bo;
|
||||
|
||||
import org.ruoyi.common.core.validate.AddGroup;
|
||||
import org.ruoyi.common.core.validate.EditGroup;
|
||||
import org.ruoyi.domain.KnowledgeInfo;
|
||||
import org.ruoyi.core.domain.BaseEntity;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.ruoyi.common.core.validate.AddGroup;
|
||||
import org.ruoyi.common.core.validate.EditGroup;
|
||||
import org.ruoyi.core.domain.BaseEntity;
|
||||
import org.ruoyi.domain.KnowledgeInfo;
|
||||
|
||||
/**
|
||||
* 知识库业务对象 knowledge_info
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
package org.ruoyi.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import org.ruoyi.domain.KnowledgeAttachPic;
|
||||
|
||||
|
||||
/**
|
||||
* 知识库附件图片列视图对象 knowledge_attach_pic
|
||||
*
|
||||
* @author Albert
|
||||
* @date 2025-05-15
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = KnowledgeAttachPic.class)
|
||||
public class KnowledgeAttachPicVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ExcelProperty(value = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 知识库id
|
||||
*/
|
||||
@ExcelProperty(value = "知识库id")
|
||||
private String kid;
|
||||
|
||||
/**
|
||||
* 附件id
|
||||
*/
|
||||
@ExcelProperty(value = "附件id")
|
||||
private String aid;
|
||||
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
@ExcelProperty(value = "文档名称")
|
||||
private String docName;
|
||||
|
||||
/**
|
||||
* 文档类型
|
||||
*/
|
||||
@ExcelProperty(value = "文档类型")
|
||||
private String docType;
|
||||
|
||||
/**
|
||||
* 文档内容
|
||||
*/
|
||||
@ExcelProperty(value = "文档内容")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 所在页数
|
||||
*/
|
||||
@ExcelProperty(value = "所在页数")
|
||||
private Integer pageNum;
|
||||
|
||||
/**
|
||||
* 所在页index
|
||||
*/
|
||||
@ExcelProperty(value = "所在页index")
|
||||
private Integer indexNum;
|
||||
|
||||
/**
|
||||
* 分析图片状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
@ExcelProperty(value = "分析图片状态10未开始,20进行中,30已完成")
|
||||
private Integer picAnysStatus;
|
||||
|
||||
/**
|
||||
* 对象存储主键
|
||||
*/
|
||||
@ExcelProperty(value = "对象存储主键")
|
||||
private Long ossId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package org.ruoyi.domain.vo;
|
||||
|
||||
import org.ruoyi.domain.KnowledgeAttach;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.ruoyi.domain.KnowledgeAttach;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.ruoyi.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.ruoyi.domain.KnowledgeFragment;
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.ruoyi.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.ruoyi.common.excel.annotation.ExcelDictFormat;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.ruoyi.mapper;
|
||||
|
||||
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.KnowledgeAttach;
|
||||
import org.ruoyi.domain.vo.KnowledgeAttachVo;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 知识库附件Mapper接口
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package org.ruoyi.mapper;
|
||||
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.KnowledgeAttachPic;
|
||||
import org.ruoyi.domain.vo.KnowledgeAttachPicVo;
|
||||
|
||||
/**
|
||||
* 知识库附件图片列Mapper接口
|
||||
*
|
||||
* @author Albert
|
||||
* @date 2025-05-15
|
||||
*/
|
||||
public interface KnowledgeAttachPicMapper extends BaseMapperPlus<KnowledgeAttachPic, KnowledgeAttachPicVo> {
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.ruoyi.mapper;
|
||||
|
||||
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.KnowledgeFragment;
|
||||
import org.ruoyi.domain.vo.KnowledgeFragmentVo;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 知识片段Mapper接口
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.ruoyi.mapper;
|
||||
|
||||
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.KnowledgeInfo;
|
||||
import org.ruoyi.domain.vo.KnowledgeInfoVo;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 知识库Mapper接口
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package org.ruoyi.service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.domain.bo.KnowledgeAttachPicBo;
|
||||
import org.ruoyi.domain.vo.KnowledgeAttachPicVo;
|
||||
|
||||
/**
|
||||
* 知识库附件图片列Service接口
|
||||
*
|
||||
* @author Albert
|
||||
* @date 2025-05-15
|
||||
*/
|
||||
public interface IKnowledgeAttachPicService {
|
||||
|
||||
/**
|
||||
* 查询知识库附件图片列
|
||||
*/
|
||||
KnowledgeAttachPicVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询知识库附件图片列列表
|
||||
*/
|
||||
TableDataInfo<KnowledgeAttachPicVo> queryPageList(KnowledgeAttachPicBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询知识库附件图片列列表
|
||||
*/
|
||||
List<KnowledgeAttachPicVo> queryList(KnowledgeAttachPicBo bo);
|
||||
|
||||
/**
|
||||
* 新增知识库附件图片列
|
||||
*/
|
||||
Boolean insertByBo(KnowledgeAttachPicBo bo);
|
||||
|
||||
/**
|
||||
* 修改知识库附件图片列
|
||||
*/
|
||||
Boolean updateByBo(KnowledgeAttachPicBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除知识库附件图片列信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package org.ruoyi.service;
|
||||
|
||||
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.domain.bo.KnowledgeAttachBo;
|
||||
import org.ruoyi.domain.vo.KnowledgeAttachVo;
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.ruoyi.service;
|
||||
|
||||
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.domain.bo.KnowledgeFragmentBo;
|
||||
import org.ruoyi.domain.vo.KnowledgeFragmentVo;
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package org.ruoyi.service;
|
||||
|
||||
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.domain.bo.KnowledgeInfoBo;
|
||||
import org.ruoyi.domain.bo.KnowledgeInfoUploadBo;
|
||||
import org.ruoyi.domain.vo.KnowledgeInfoVo;
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
package org.ruoyi.service.impl;
|
||||
|
||||
import org.ruoyi.common.core.utils.MapstructUtils;
|
||||
import org.ruoyi.common.core.utils.StringUtils;
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.ruoyi.domain.KnowledgeAttachPic;
|
||||
import org.ruoyi.domain.bo.KnowledgeAttachPicBo;
|
||||
import org.ruoyi.domain.vo.KnowledgeAttachPicVo;
|
||||
import org.ruoyi.mapper.KnowledgeAttachPicMapper;
|
||||
import org.ruoyi.service.IKnowledgeAttachPicService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 知识库附件图片列Service业务层处理
|
||||
*
|
||||
* @author ageerle
|
||||
* @date 2025-05-15
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class KnowledgeAttachPicServiceImpl implements IKnowledgeAttachPicService {
|
||||
|
||||
private final KnowledgeAttachPicMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询知识库附件图片列
|
||||
*/
|
||||
@Override
|
||||
public KnowledgeAttachPicVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询知识库附件图片列列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<KnowledgeAttachPicVo> queryPageList(KnowledgeAttachPicBo bo,
|
||||
PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<KnowledgeAttachPic> lqw = buildQueryWrapper(bo);
|
||||
Page<KnowledgeAttachPicVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询知识库附件图片列列表
|
||||
*/
|
||||
@Override
|
||||
public List<KnowledgeAttachPicVo> queryList(KnowledgeAttachPicBo bo) {
|
||||
LambdaQueryWrapper<KnowledgeAttachPic> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<KnowledgeAttachPic> buildQueryWrapper(KnowledgeAttachPicBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<KnowledgeAttachPic> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getKid()), KnowledgeAttachPic::getKid, bo.getKid());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getAid()), KnowledgeAttachPic::getAid, bo.getAid());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDocName()), KnowledgeAttachPic::getDocName,
|
||||
bo.getDocName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDocType()), KnowledgeAttachPic::getDocType,
|
||||
bo.getDocType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getContent()), KnowledgeAttachPic::getContent,
|
||||
bo.getContent());
|
||||
lqw.eq(bo.getPageNum() != null, KnowledgeAttachPic::getPageNum, bo.getPageNum());
|
||||
lqw.eq(bo.getIndexNum() != null, KnowledgeAttachPic::getIndexNum, bo.getIndexNum());
|
||||
lqw.eq(bo.getPicAnysStatus() != null, KnowledgeAttachPic::getPicAnysStatus,
|
||||
bo.getPicAnysStatus());
|
||||
lqw.eq(bo.getOssId() != null, KnowledgeAttachPic::getOssId, bo.getOssId());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增知识库附件图片列
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(KnowledgeAttachPicBo bo) {
|
||||
KnowledgeAttachPic add = MapstructUtils.convert(bo, KnowledgeAttachPic.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改知识库附件图片列
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(KnowledgeAttachPicBo bo) {
|
||||
KnowledgeAttachPic update = MapstructUtils.convert(bo, KnowledgeAttachPic.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(KnowledgeAttachPic entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除知识库附件图片列
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,26 @@
|
||||
package org.ruoyi.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import java.util.stream.Collectors;
|
||||
import org.ruoyi.common.core.utils.MapstructUtils;
|
||||
import org.ruoyi.common.core.utils.StringUtils;
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.ruoyi.domain.KnowledgeAttachPic;
|
||||
import org.ruoyi.domain.vo.KnowledgeAttachVo;
|
||||
import org.ruoyi.mapper.KnowledgeAttachPicMapper;
|
||||
import org.ruoyi.mapper.KnowledgeFragmentMapper;
|
||||
import org.ruoyi.system.service.ISysOssService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.ruoyi.domain.bo.KnowledgeAttachBo;
|
||||
|
||||
import org.ruoyi.common.core.utils.MapstructUtils;
|
||||
import org.ruoyi.common.core.utils.StringUtils;
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.domain.KnowledgeAttach;
|
||||
import org.ruoyi.domain.bo.KnowledgeAttachBo;
|
||||
import org.ruoyi.domain.vo.KnowledgeAttachVo;
|
||||
import org.ruoyi.mapper.KnowledgeAttachMapper;
|
||||
import org.ruoyi.mapper.KnowledgeFragmentMapper;
|
||||
import org.ruoyi.service.IKnowledgeAttachService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 知识库附件Service业务层处理
|
||||
@@ -41,9 +35,7 @@ public class KnowledgeAttachServiceImpl implements IKnowledgeAttachService {
|
||||
private final KnowledgeAttachMapper baseMapper;
|
||||
private final KnowledgeFragmentMapper fragmentMapper;
|
||||
|
||||
private final ISysOssService ossService;
|
||||
|
||||
private final KnowledgeAttachPicMapper picMapper;
|
||||
|
||||
/**
|
||||
* 查询知识库附件
|
||||
@@ -129,86 +121,12 @@ public class KnowledgeAttachServiceImpl implements IKnowledgeAttachService {
|
||||
public void removeKnowledgeAttach(String docId) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("doc_id", docId);
|
||||
List<KnowledgeAttachVo> knowledgeAttachVos = baseMapper.selectVoByMap(map);
|
||||
if (ObjectUtil.isNotEmpty(knowledgeAttachVos)) {
|
||||
Collection<Long> ossIds = knowledgeAttachVos.stream()
|
||||
.map(KnowledgeAttachVo::getOssId)
|
||||
.collect(Collectors.toList());
|
||||
//删除oss
|
||||
ossService.deleteWithValidByIds(ossIds, false);
|
||||
//删除图片oss
|
||||
List<KnowledgeAttachPic> knowledgeAttachPics = picMapper.selectList(
|
||||
new LambdaQueryWrapper<KnowledgeAttachPic>()
|
||||
.in(KnowledgeAttachPic::getKid,
|
||||
knowledgeAttachVos.stream().map(KnowledgeAttachVo::getKid)
|
||||
.collect(Collectors.toList()))
|
||||
.in(KnowledgeAttachPic::getAid,
|
||||
knowledgeAttachVos.stream().map(KnowledgeAttachVo::getId)
|
||||
.collect(Collectors.toList()))
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(knowledgeAttachPics)) {
|
||||
Collection<Long> tossIds = knowledgeAttachPics.stream()
|
||||
.map(KnowledgeAttachPic::getOssId)
|
||||
.collect(Collectors.toList());
|
||||
ossService.deleteWithValidByIds(tossIds, false);
|
||||
List<Long> collect = knowledgeAttachPics.stream().map(KnowledgeAttachPic::getId)
|
||||
.collect(Collectors.toList());
|
||||
picMapper.deleteByIds(collect);
|
||||
}
|
||||
}
|
||||
baseMapper.deleteByMap(map);
|
||||
fragmentMapper.deleteByMap(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String translationByFile(MultipartFile file, String targetLanguage) {
|
||||
/*String fileName = file.getOriginalFilename();
|
||||
String docType = fileName.substring(fileName.lastIndexOf(".")+1);
|
||||
String content = "";
|
||||
ResourceLoader resourceLoader = resourceLoaderFactory.getLoaderByFileType(docType);
|
||||
try {
|
||||
content = resourceLoader.getContent(file.getInputStream());
|
||||
} catch (IOException e) {
|
||||
throw new BaseException("该文件类型暂不支持!");
|
||||
}
|
||||
// 翻译模型固定为gpt-4o-mini
|
||||
String model = "gpt-4o-mini";
|
||||
ChatMessageBo chatMessageBo = new ChatMessageBo();
|
||||
chatMessageBo.setUserId(getUserId());
|
||||
chatMessageBo.setModelName(model);
|
||||
chatMessageBo.setContent(content);
|
||||
chatMessageBo.setDeductCost(0.01);
|
||||
chatMessageBo.setTotalTokens(0);
|
||||
OpenAiStreamClient openAiStreamClient = chatConfig.getOpenAiStreamClient();
|
||||
List<Message> messageList = new ArrayList<>();
|
||||
Message sysMessage = Message.builder().role(Message.Role.SYSTEM).content("你是一位精通各国语言的翻译大师\n" +
|
||||
"\n" +
|
||||
"请将用户输入词语翻译成{" + targetLanguage + "}\n" +
|
||||
"\n" +
|
||||
"==示例输出==\n" +
|
||||
"**原文** : <这里显示要翻译的原文信息>\n" +
|
||||
"**翻译** : <这里显示翻译之后的结果>\n" +
|
||||
"**总结** : <这里是对关键信息一个总结>\n" +
|
||||
"**提取的关键信息** : <这里返回关键信息>\n" +
|
||||
"==示例结束==\n" +
|
||||
"\n" +
|
||||
"注意:请严格按示例进行输出,返回markdown格式").build();
|
||||
messageList.add(sysMessage);
|
||||
Message message = Message.builder().role(Message.Role.USER).content(content).build();
|
||||
messageList.add(message);
|
||||
ChatCompletionResponse chatCompletionResponse = null;
|
||||
try {
|
||||
ChatCompletion chatCompletion = ChatCompletion
|
||||
.builder()
|
||||
.messages(messageList)
|
||||
.model(model)
|
||||
.stream(false)
|
||||
.build();
|
||||
chatCompletionResponse = openAiStreamClient.chatCompletion(chatCompletion);
|
||||
}catch (Exception e) {
|
||||
throw new BaseException("调用大模型失败,请检查密钥是否正确!");
|
||||
}
|
||||
return chatCompletionResponse.getChoices().get(0).getMessage().getContent().toString();*/
|
||||
return "接口开发中!";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
package org.ruoyi.service.impl;
|
||||
|
||||
import org.ruoyi.common.core.utils.MapstructUtils;
|
||||
import org.ruoyi.common.core.utils.StringUtils;
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.ruoyi.domain.vo.KnowledgeFragmentVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.ruoyi.domain.bo.KnowledgeFragmentBo;
|
||||
import org.ruoyi.common.core.utils.MapstructUtils;
|
||||
import org.ruoyi.common.core.utils.StringUtils;
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.domain.KnowledgeFragment;
|
||||
import org.ruoyi.domain.bo.KnowledgeFragmentBo;
|
||||
import org.ruoyi.domain.vo.KnowledgeFragmentVo;
|
||||
import org.ruoyi.mapper.KnowledgeFragmentMapper;
|
||||
import org.ruoyi.service.IKnowledgeFragmentService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 知识片段Service业务层处理
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.ruoyi.domain.bo.QueryVectorBo;
|
||||
import org.ruoyi.domain.bo.StoreEmbeddingBo;
|
||||
import org.ruoyi.service.VectorStoreService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
Reference in New Issue
Block a user