diff --git a/xinnengyuan/file/resource/design/main.exe b/xinnengyuan/file/resource/design/main.exe new file mode 100644 index 00000000..b6711acf Binary files /dev/null and b/xinnengyuan/file/resource/design/main.exe differ diff --git a/xinnengyuan/ruoyi-admin/src/main/resources/application-prod.yml b/xinnengyuan/ruoyi-admin/src/main/resources/application-prod.yml index 80ccd31f..d1ef3fb1 100644 --- a/xinnengyuan/ruoyi-admin/src/main/resources/application-prod.yml +++ b/xinnengyuan/ruoyi-admin/src/main/resources/application-prod.yml @@ -54,7 +54,7 @@ spring: # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) url: jdbc:mysql://192.168.110.2:13386/xinnengyuan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true username: xinnengyuan - password: caJWNthNFaNRpRNy + password: mEZPC5Sdf3r2HENi # # 从库数据源 # slave: # lazy: true diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/constant/DesTechnicalStandardConstant.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/constant/DesTechnicalStandardConstant.java new file mode 100644 index 00000000..3f727203 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/constant/DesTechnicalStandardConstant.java @@ -0,0 +1,41 @@ +package org.dromara.design.constant; + +import java.util.List; + +/** + * @author lcj + * @date 2025/7/2 15:08 + */ +public interface DesTechnicalStandardConstant { + + /** + * 顶级目录前缀 + */ + String TOP_FOLDER_PREFIX = "doc/design/knowledge/"; + + /** + * 顶级目录名称 + */ + String TOP_FOLDER_NAME = "技术标准管理"; + + /** + * 二级目录名称 + */ + List SECOND_LEVEL_FOLDER_NAME = List.of("设计输入条件", "设计原则", "业主需求清单"); + + /** + * 图片后缀列表 + */ + List PICTURE_SUFFIX_LIST = List.of("jpeg", "jpg", "png", "webp"); + + /** + * 获取顶级目录前缀 + * + * @param projectId 项目id + * @return 顶级目录前缀 + */ + static String getTopFolderPrefix(Long projectId) { + return String.format("%s%s/", TOP_FOLDER_PREFIX, projectId); + } + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/controller/DesTechnicalStandardController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/controller/DesTechnicalStandardController.java new file mode 100644 index 00000000..246709eb --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/controller/DesTechnicalStandardController.java @@ -0,0 +1,160 @@ +package org.dromara.design.controller; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.core.lang.tree.Tree; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.NotNull; +import org.dromara.common.core.domain.R; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.web.core.BaseController; +import org.dromara.design.domain.dto.technicalstandard.DesTechnicalStandardFileCreateReq; +import org.dromara.design.domain.dto.technicalstandard.DesTechnicalStandardFileQueryReq; +import org.dromara.design.domain.dto.technicalstandard.DesTechnicalStandardFileUpdateReq; +import org.dromara.design.domain.dto.technicalstandard.DesTechnicalStandardQueryReq; +import org.dromara.design.domain.vo.technicalstandard.DesTechnicalStandardVo; +import org.dromara.design.service.IDesTechnicalStandardService; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + * 技术管理标准 + * + * @author lcj + * @date 2025-07-02 + */ +@Validated +@RestController +@RequestMapping("/design/technicalStandard") +public class DesTechnicalStandardController extends BaseController { + + @Resource + private IDesTechnicalStandardService desTechnicalStandardService; + + /** + * 分页查询技术管理标准文件列表 + */ + @SaCheckPermission("design:technicalStandard:list") + @GetMapping("/file/page") + public TableDataInfo queryFilePageList(DesTechnicalStandardFileQueryReq req, PageQuery pageQuery) { + return desTechnicalStandardService.queryFilePageByFolderId(req, pageQuery); + } + + /** + * 查询技术管理标准文件列表 + */ + @SaCheckPermission("design:technicalStandard:list") + @GetMapping("/file/list/{folderId}") + public R> queryFileListByFolderId(@NotNull(message = "主键不能为空") + @PathVariable Long folderId) { + return R.ok(desTechnicalStandardService.queryFileListByFolderId(folderId)); + } + + /** + * 查询技术管理标准文件树列表 + */ + @SaCheckPermission("design:technicalStandard:list") + @GetMapping("/folder/tree/list") + public R>> queryFolderTreeList(DesTechnicalStandardQueryReq req) { + List> list = desTechnicalStandardService.queryFolderTreeList(req); + return R.ok(list); + } + + /** + * 查询技术管理标准回收站文件列表 + */ + @SaCheckPermission("design:technicalStandard:list") + @GetMapping("/recycleBin/list") + public TableDataInfo queryRecycleBinPageList(DesTechnicalStandardQueryReq req, PageQuery pageQuery) { + return desTechnicalStandardService.queryRecycleBinPageList(req, pageQuery); + } + + /** + * 获取技术管理标准详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("design:technicalStandard:query") + @GetMapping("/{id}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long id) { + return R.ok(desTechnicalStandardService.queryById(id)); + } + + /** + * 新增技术管理标准文件 + */ + @SaCheckPermission("design:technicalStandard:add") + @Log(title = "技术管理标准", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping("/file") + public R add(@RequestPart("file") MultipartFile file, DesTechnicalStandardFileCreateReq req) { + return toAjax(desTechnicalStandardService.insertFile(file, req)); + } + + /** + * 修改技术管理标准 + */ + @SaCheckPermission("design:technicalStandard:edit") + @Log(title = "技术管理标准", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping("/file") + public R edit(@RequestBody DesTechnicalStandardFileUpdateReq req) { + return toAjax(desTechnicalStandardService.updateFile(req)); + } + + /** + * 删除技术管理标准文件 + * + * @param id 主键 + */ + @SaCheckPermission("design:technicalStandard:remove") + @Log(title = "技术管理标准", businessType = BusinessType.DELETE) + @DeleteMapping("/file/{id}") + public R remove(@NotNull(message = "主键不能为空") + @PathVariable Long id) { + return toAjax(desTechnicalStandardService.deleteFileById(id)); + } + + /** + * 批量删除技术管理标准回收站文件信息 + * + * @param ids 主键串 + */ + @SaCheckPermission("design:technicalStandard:remove") + @Log(title = "技术管理标准", businessType = BusinessType.DELETE) + @DeleteMapping("/file/recycleBin/{ids}") + public R removeRecycleBin(@NotNull(message = "主键不能为空") + @PathVariable Long[] ids) { + return toAjax(desTechnicalStandardService.deleteRecycleBinFileBatchByIds(List.of(ids))); + } + + /** + * 根据主键id批量恢复 + */ + @SaCheckPermission("design:technicalStandard:recovery") + @Log(title = "技术管理标准", businessType = BusinessType.UPDATE) + @PostMapping("/recovery/{ids}") + public R recoveryBatchById(@NotNull(message = "主键不能为空") + @PathVariable Long[] ids) { + return toAjax(desTechnicalStandardService.recoveryBatchById(List.of(ids))); + } + + /** + * 畅写在线修改保存回调 + */ + @SaCheckPermission("design:technicalStandard:edit") + @PostMapping("/changxie/callback/{id}") + public void singleFileUploads(@NotNull(message = "主键不能为空") + @PathVariable Long id, HttpServletRequest request, HttpServletResponse response) { + desTechnicalStandardService.singleFileUploads(id, request, response); + } +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/DesTechnicalStandard.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/DesTechnicalStandard.java new file mode 100644 index 00000000..3503383c --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/DesTechnicalStandard.java @@ -0,0 +1,87 @@ +package org.dromara.design.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.dromara.common.mybatis.core.domain.BaseEntity; + +import java.io.Serial; +import java.util.Date; + +/** + * 技术管理标准对象 des_technical_standard + * + * @author lcj + * @date 2025-07-02 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("des_technical_standard") +public class DesTechnicalStandard extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value = "id") + private Long id; + + /** + * 项目id + */ + private Long projectId; + + /** + * 父级(0代表顶级) + */ + private Long pid; + + /** + * 文件名称 + */ + private String fileName; + + /** + * 文件路径 + */ + private String filePath; + + /** + * 文件访问路径 + */ + private String fileUrl; + + /** + * 文件类型(1文件夹 2文件 3图片) + */ + private String fileType; + + /** + * 文件后缀 + */ + private String fileSuffix; + + /** + * 状态(0正常 1删除) + */ + private String fileStatus; + + /** + * 原文件名 + */ + private String originalName; + + /** + * 备注 + */ + private String remark; + + /** + * 删除时间 + */ + private Date deletedAt; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/dto/technicalstandard/DesTechnicalStandardFileCreateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/dto/technicalstandard/DesTechnicalStandardFileCreateReq.java new file mode 100644 index 00000000..2e838569 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/dto/technicalstandard/DesTechnicalStandardFileCreateReq.java @@ -0,0 +1,33 @@ +package org.dromara.design.domain.dto.technicalstandard; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * @author lcj + * @date 2025/7/2 14:54 + */ +@Data +public class DesTechnicalStandardFileCreateReq implements Serializable { + + @Serial + private static final long serialVersionUID = -8966480198606343837L; + + /** + * 项目id + */ + private Long projectId; + + /** + * 父级(0代表顶级) + */ + private Long pid; + + /** + * 备注 + */ + private String remark; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/dto/technicalstandard/DesTechnicalStandardFileQueryReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/dto/technicalstandard/DesTechnicalStandardFileQueryReq.java new file mode 100644 index 00000000..7ea04e12 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/dto/technicalstandard/DesTechnicalStandardFileQueryReq.java @@ -0,0 +1,33 @@ +package org.dromara.design.domain.dto.technicalstandard; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * @author lcj + * @date 2025/7/2 14:55 + */ +@Data +public class DesTechnicalStandardFileQueryReq implements Serializable { + + @Serial + private static final long serialVersionUID = 8469150974619675423L; + + /** + * 项目id + */ + private Long projectId; + + /** + * 文件夹id + */ + private Long folderId; + + /** + * 文件名 + */ + private String fileName; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/dto/technicalstandard/DesTechnicalStandardFileUpdateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/dto/technicalstandard/DesTechnicalStandardFileUpdateReq.java new file mode 100644 index 00000000..0d7d07d5 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/dto/technicalstandard/DesTechnicalStandardFileUpdateReq.java @@ -0,0 +1,38 @@ +package org.dromara.design.domain.dto.technicalstandard; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * @author lcj + * @date 2025/7/2 14:58 + */ +@Data +public class DesTechnicalStandardFileUpdateReq implements Serializable { + + @Serial + private static final long serialVersionUID = -8139865110310278870L; + + /** + * 主键id + */ + private Long id; + + /** + * 父级(0代表顶级) + */ + private Long pid; + + /** + * 文件名称 + */ + private String fileName; + + /** + * 备注 + */ + private String remark; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/dto/technicalstandard/DesTechnicalStandardQueryReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/dto/technicalstandard/DesTechnicalStandardQueryReq.java new file mode 100644 index 00000000..499b8535 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/dto/technicalstandard/DesTechnicalStandardQueryReq.java @@ -0,0 +1,28 @@ +package org.dromara.design.domain.dto.technicalstandard; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * @author lcj + * @date 2025/7/2 15:01 + */ +@Data +public class DesTechnicalStandardQueryReq implements Serializable { + + @Serial + private static final long serialVersionUID = -3045536128635208498L; + + /** + * 项目id + */ + private Long projectId; + + /** + * 文件名 + */ + private String fileName; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/vo/technicalstandard/DesTechnicalStandardVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/vo/technicalstandard/DesTechnicalStandardVo.java new file mode 100644 index 00000000..caa34128 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/vo/technicalstandard/DesTechnicalStandardVo.java @@ -0,0 +1,79 @@ +package org.dromara.design.domain.vo.technicalstandard; + +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import org.dromara.design.domain.DesTechnicalStandard; + +import java.io.Serial; +import java.io.Serializable; + + +/** + * 技术管理标准视图对象 des_technical_standard + * + * @author lcj + * @date 2025-07-02 + */ +@Data +@AutoMapper(target = DesTechnicalStandard.class) +public class DesTechnicalStandardVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + private Long id; + + /** + * 项目id + */ + private Long projectId; + + /** + * 父级(0代表顶级) + */ + private Long pid; + + /** + * 文件名称 + */ + private String fileName; + + /** + * 文件路径 + */ + private String filePath; + + /** + * 文件访问路径 + */ + private String fileUrl; + + /** + * 文件类型(1文件夹 2文件 3图片) + */ + private String fileType; + + /** + * 文件后缀 + */ + private String fileSuffix; + + /** + * 状态(0正常 1删除) + */ + private String fileStatus; + + /** + * 原文件名 + */ + private String originalName; + + /** + * 备注 + */ + private String remark; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/mapper/DesTechnicalStandardMapper.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/mapper/DesTechnicalStandardMapper.java new file mode 100644 index 00000000..80f7c5a2 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/mapper/DesTechnicalStandardMapper.java @@ -0,0 +1,15 @@ +package org.dromara.design.mapper; + +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.design.domain.DesTechnicalStandard; +import org.dromara.design.domain.vo.technicalstandard.DesTechnicalStandardVo; + +/** + * 技术管理标准Mapper接口 + * + * @author lcj + * @date 2025-07-02 + */ +public interface DesTechnicalStandardMapper extends BaseMapperPlus { + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/IDesTechnicalStandardService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/IDesTechnicalStandardService.java new file mode 100644 index 00000000..4c2c000c --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/IDesTechnicalStandardService.java @@ -0,0 +1,152 @@ +package org.dromara.design.service; + +import cn.hutool.core.lang.tree.Tree; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.design.domain.DesTechnicalStandard; +import org.dromara.design.domain.dto.technicalstandard.DesTechnicalStandardFileCreateReq; +import org.dromara.design.domain.dto.technicalstandard.DesTechnicalStandardFileQueryReq; +import org.dromara.design.domain.dto.technicalstandard.DesTechnicalStandardFileUpdateReq; +import org.dromara.design.domain.dto.technicalstandard.DesTechnicalStandardQueryReq; +import org.dromara.design.domain.vo.technicalstandard.DesTechnicalStandardVo; +import org.springframework.web.multipart.MultipartFile; + +import java.util.Collection; +import java.util.List; + +/** + * 技术管理标准Service接口 + * + * @author lcj + * @date 2025-07-02 + */ +public interface IDesTechnicalStandardService extends IService { + + /** + * 查询技术管理标准 + * + * @param id 主键 + * @return 技术管理标准 + */ + DesTechnicalStandardVo queryById(Long id); + + /** + * 查询技术管理标准文件夹树列表 + * + * @param req 查询参数 + * @return 技术管理标准文件夹树列表 + */ + List> queryFolderTreeList(DesTechnicalStandardQueryReq req); + + /** + * 分页查询文件夹下的技术管理标准文件列表 + * + * @param req 查询参数 + * @param pageQuery 分页参数 + * @return 技术管理标准文件列表 + */ + TableDataInfo queryFilePageByFolderId(DesTechnicalStandardFileQueryReq req, PageQuery pageQuery); + + /** + * 查询文件夹下的技术管理标准文件列表 + * + * @param folderId 文件夹id + * @return 技术管理标准文件列表 + */ + List queryFileListByFolderId(Long folderId); + + /** + * 查询回收站中的文件 + * + * @param req 查询参数 + * @param pageQuery 分页参数 + * @return 回收站中的文件 + */ + TableDataInfo queryRecycleBinPageList(DesTechnicalStandardQueryReq req, PageQuery pageQuery); + + /** + * 新增技术管理标准文件 + * + * @param file 文件 + * @param req 技术管理标准 + * @return 是否新增成功 + */ + Boolean insertFile(MultipartFile file, DesTechnicalStandardFileCreateReq req); + + /** + * 新增技术管理标准文件夹 + * + * @param projectId 项目id + * @return 是否新增成功 + */ + Boolean insertFolderByTemplate(Long projectId); + + /** + * 修改技术管理标准文件 + * + * @param req 技术管理标准 + * @return 是否修改成功 + */ + Boolean updateFile(DesTechnicalStandardFileUpdateReq req); + + /** + * 删除技术管理标准文件信息 + * + * @param id 待删除文件的主键 + * @return 是否删除成功 + */ + Boolean deleteFileById(Long id); + + /** + * 批量删除技术管理标准回收站文件信息 + * + * @param ids 待删除文件主键集合 + * @return 是否删除成功 + */ + Boolean deleteRecycleBinFileBatchByIds(Collection ids); + + /** + * 批量恢复质量会议纪要信息 + * + * @param ids 待删除的主键集合 + * @return 是否删除成功 + */ + Boolean recoveryBatchById(Collection ids); + + /** + * 构建前端所需要下拉树结构 + * + * @param documentList 文档列表 + * @return 下拉树结构列表 + */ + List> buildTreeSelect(List documentList); + + /** + * 构建文档封装对象 + * + * @param document 文档 + * @return 文档封装对象 + */ + DesTechnicalStandardVo getVo(DesTechnicalStandard document); + + /** + * 获取文档对象视图 + * + * @param documentPage 文档对象 + * @return 文档对象视图 + */ + Page getVoPage(Page documentPage); + + /** + * 畅写在线文件修改 + * + * @param id 文档id + * @param request 请求 + * @param response 响应 + */ + void singleFileUploads(Long id, HttpServletRequest request, HttpServletResponse response); +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/impl/DesTechnicalStandardServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/impl/DesTechnicalStandardServiceImpl.java new file mode 100644 index 00000000..75944578 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/impl/DesTechnicalStandardServiceImpl.java @@ -0,0 +1,516 @@ +package org.dromara.design.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.lang.tree.Tree; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.dromara.common.core.constant.HttpStatus; +import org.dromara.common.core.exception.ServiceException; +import org.dromara.common.core.utils.*; +import org.dromara.common.enums.DocumentStatusEnum; +import org.dromara.common.enums.DocumentTypeEnum; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.oss.core.OssClient; +import org.dromara.common.oss.factory.OssFactory; +import org.dromara.common.satoken.utils.LoginHelper; +import org.dromara.design.constant.DesTechnicalStandardConstant; +import org.dromara.design.domain.DesTechnicalStandard; +import org.dromara.design.domain.dto.technicalstandard.DesTechnicalStandardFileCreateReq; +import org.dromara.design.domain.dto.technicalstandard.DesTechnicalStandardFileQueryReq; +import org.dromara.design.domain.dto.technicalstandard.DesTechnicalStandardFileUpdateReq; +import org.dromara.design.domain.dto.technicalstandard.DesTechnicalStandardQueryReq; +import org.dromara.design.domain.vo.technicalstandard.DesTechnicalStandardVo; +import org.dromara.design.mapper.DesTechnicalStandardMapper; +import org.dromara.design.service.IDesTechnicalStandardService; +import org.dromara.project.service.IBusProjectService; +import org.dromara.system.domain.vo.SysOssUploadVo; +import org.dromara.system.service.ISysOssService; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 技术管理标准Service业务层处理 + * + * @author lcj + * @date 2025-07-02 + */ +@Service +public class DesTechnicalStandardServiceImpl extends ServiceImpl + implements IDesTechnicalStandardService { + + @Resource + private IBusProjectService projectService; + + @Resource + private ISysOssService ossService; + + /** + * 查询质量知识库 + * + * @param id 主键 + * @return 质量知识库 + */ + @Override + public DesTechnicalStandardVo queryById(Long id) { + DesTechnicalStandard entity = this.getById(id); + if (entity == null) { + throw new ServiceException("质量知识库文件或文件夹不存在", HttpStatus.NOT_FOUND); + } + return this.getVo(entity); + } + + /** + * 查询质量知识库文件夹树列表 + * + * @param req 查询参数 + * @return 质量知识库文件夹树列表 + */ + @Override + public List> queryFolderTreeList(DesTechnicalStandardQueryReq req) { + Long projectId = req.getProjectId(); + List folderList = this.lambdaQuery() + .eq(DesTechnicalStandard::getProjectId, projectId) + .eq(DesTechnicalStandard::getFileType, DocumentTypeEnum.FOLDER.getValue()) + .eq(DesTechnicalStandard::getFileStatus, DocumentStatusEnum.NORMAL.getValue()) + .list(); + return this.buildTreeSelect(folderList); + } + + /** + * 查询文件夹下的质量知识库文件列表 + * + * @param req 查询参数 + * @param pageQuery 分页参数 + * @return 质量知识库文件列表 + */ + @Override + public TableDataInfo queryFilePageByFolderId(DesTechnicalStandardFileQueryReq req, PageQuery pageQuery) { + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + Long folderId = req.getFolderId(); + if (folderId != null) { + DesTechnicalStandard folder = this.getById(folderId); + if (folder == null) { + throw new ServiceException("文件夹不存在", HttpStatus.NOT_FOUND); + } + if (!DocumentTypeEnum.FOLDER.getValue().equals(folder.getFileType())) { + throw new ServiceException("所选目录不是文件夹", HttpStatus.BAD_REQUEST); + } + lqw.eq(DesTechnicalStandard::getPid, folderId); + } + lqw.eq(ObjectUtils.isNotEmpty(req.getProjectId()), DesTechnicalStandard::getProjectId, req.getProjectId()); + lqw.ne(DesTechnicalStandard::getFileType, DocumentTypeEnum.FOLDER.getValue()); + lqw.eq(DesTechnicalStandard::getFileStatus, DocumentStatusEnum.NORMAL.getValue()); + lqw.like(StringUtils.isNotBlank(req.getFileName()), DesTechnicalStandard::getFileName, req.getFileName()); + Page documentPage = this.page(pageQuery.build(), lqw); + return TableDataInfo.build(this.getVoPage(documentPage)); + } + + /** + * 查询文件夹下的质量知识库文件列表 + * + * @param folderId 文件夹id + * @return 质量知识库文件列表 + */ + @Override + public List queryFileListByFolderId(Long folderId) { + DesTechnicalStandard folder = this.getById(folderId); + if (folder == null) { + throw new ServiceException("文件夹不存在", HttpStatus.NOT_FOUND); + } + if (!DocumentTypeEnum.FOLDER.getValue().equals(folder.getFileType())) { + throw new ServiceException("所选目录不是文件夹", HttpStatus.BAD_REQUEST); + } + List list = this.lambdaQuery() + .eq(DesTechnicalStandard::getPid, folderId) + .ne(DesTechnicalStandard::getFileType, DocumentTypeEnum.FOLDER.getValue()) + .eq(DesTechnicalStandard::getFileStatus, DocumentStatusEnum.NORMAL.getValue()) + .list(); + return list.stream().map(this::getVo).toList(); + } + + /** + * 查询回收站中的文件 + * + * @param req 查询参数 + * @param pageQuery 分页参数 + * @return 回收站中的文件 + */ + @Override + public TableDataInfo queryRecycleBinPageList(DesTechnicalStandardQueryReq req, PageQuery pageQuery) { + Long projectId = req.getProjectId(); + if (projectService.getById(projectId) == null) { + throw new ServiceException("项目不存在", HttpStatus.NOT_FOUND); + } + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + lqw.eq(DesTechnicalStandard::getProjectId, projectId); + lqw.eq(DesTechnicalStandard::getFileStatus, DocumentStatusEnum.DELETE.getValue()); + lqw.like(StringUtils.isNotBlank(req.getFileName()), DesTechnicalStandard::getFileName, req.getFileName()); + lqw.orderByDesc(DesTechnicalStandard::getDeletedAt); + Page result = this.page(pageQuery.build(), lqw); + return TableDataInfo.build(this.getVoPage(result)); + } + + /** + * 新增质量知识库文件 + * + * @param file 文件 + * @param req 质量知识库 + * @return 是否新增成功 + */ + @Override + public Boolean insertFile(MultipartFile file, DesTechnicalStandardFileCreateReq req) { + // 数据校验 + if (ObjectUtils.isEmpty(file)) { + throw new ServiceException("文件不能为空", HttpStatus.BAD_REQUEST); + } + Long projectId = req.getProjectId(); + if (projectService.getById(projectId) == null) { + throw new ServiceException("项目不存在", HttpStatus.BAD_REQUEST); + } + // 拼接文件名 + String originalFilename = file.getOriginalFilename(); + String suffix = FileUtil.getSuffix(originalFilename); + if (StringUtils.isBlank(suffix)) { + throw new ServiceException("文件格式错误", HttpStatus.BAD_REQUEST); + } + String date = DateUtils.getDate(); + String uuid = IdUtil.fastSimpleUUID(); + String fileName = String.format("%s_%s.%s", date, uuid, suffix); + // 拼接文件路径 + Long pid = req.getPid(); + if (pid == null || pid == 0) { + throw new ServiceException("不能在根目录上传文件", HttpStatus.BAD_REQUEST); + } + DesTechnicalStandard pDesTechnicalStandard = this.getById(pid); + // 校验父级目录 + validParentFolder(pDesTechnicalStandard, projectId); + String filePath = pDesTechnicalStandard.getFilePath() + "/" + fileName; + // 上传文件 + SysOssUploadVo ossUploadVo = ossService.uploadWithNoSave(file, filePath); + // 保存文件信息 + DesTechnicalStandard desTechnicalStandard = new DesTechnicalStandard(); + desTechnicalStandard.setFilePath(filePath); + desTechnicalStandard.setFileUrl(ossUploadVo.getUrl()); + desTechnicalStandard.setFileSuffix(suffix); + if (DesTechnicalStandardConstant.PICTURE_SUFFIX_LIST.contains(suffix)) { + desTechnicalStandard.setFileType(DocumentTypeEnum.PICTURE.getValue()); + } else { + desTechnicalStandard.setFileType(DocumentTypeEnum.FILE.getValue()); + } + desTechnicalStandard.setFileName(FileUtil.getPrefix(originalFilename)); + desTechnicalStandard.setOriginalName(originalFilename); + desTechnicalStandard.setProjectId(projectId); + desTechnicalStandard.setPid(pid); + boolean save = this.save(desTechnicalStandard); + if (!save) { + throw new ServiceException("新增文件失败,数据库异常", HttpStatus.ERROR); + } + return true; + } + + /** + * 新增质量知识库文件夹 + * + * @param projectId 项目id + * @return 是否新增成功 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean insertFolderByTemplate(Long projectId) { + // 创建顶级目录 + String prefix = DesTechnicalStandardConstant.getTopFolderPrefix(projectId); + String topPath = prefix + DesTechnicalStandardConstant.TOP_FOLDER_NAME; + DesTechnicalStandard topFolder = new DesTechnicalStandard(); + topFolder.setProjectId(projectId); + topFolder.setPid(0L); + topFolder.setFileName(DesTechnicalStandardConstant.TOP_FOLDER_NAME); + topFolder.setFilePath(topPath); + topFolder.setFileType(DocumentTypeEnum.FOLDER.getValue()); + boolean save = this.save(topFolder); + if (!save) { + throw new ServiceException("新增顶级目录失败,数据库异常", HttpStatus.ERROR); + } + // 创建二级目录 + Long pid = topFolder.getId(); + List documents = DesTechnicalStandardConstant.SECOND_LEVEL_FOLDER_NAME.stream().map(name -> { + DesTechnicalStandard folder = new DesTechnicalStandard(); + String path = topPath + "/" + name; + folder.setProjectId(projectId); + folder.setPid(pid); + folder.setFileName(name); + folder.setFilePath(path); + folder.setFileType(DocumentTypeEnum.FOLDER.getValue()); + return folder; + }).toList(); + return this.saveBatch(documents); + } + + /** + * 修改质量知识库文件 + * + * @param req 质量知识库 + * @return 是否修改成功 + */ + @Override + public Boolean updateFile(DesTechnicalStandardFileUpdateReq req) { + Long id = req.getId(); + DesTechnicalStandard oldDocument = this.getById(id); + if (oldDocument == null) { + throw new ServiceException("修改质量知识库文件失败,数据不存在", HttpStatus.NOT_FOUND); + } + DesTechnicalStandard document = new DesTechnicalStandard(); + BeanUtils.copyProperties(req, document); + boolean result = this.updateById(document); + if (!result) { + throw new ServiceException("修改质量知识库文件失败", HttpStatus.ERROR); + } + return true; + } + + /** + * 删除质量知识库文件信息 + * + * @param id 待删除文件的主键 + * @return 是否删除成功 + */ + @Override + public Boolean deleteFileById(Long id) { + DesTechnicalStandard document = this.getById(id); + if (document == null) { + throw new ServiceException("文件不存在", HttpStatus.ERROR); + } + if (!document.getFileStatus().equals(DocumentStatusEnum.NORMAL.getValue())) { + throw new ServiceException("文件已删除", HttpStatus.ERROR); + } + if (document.getFileType().equals(DocumentTypeEnum.FOLDER.getValue())) { + throw new ServiceException("文件夹不能删除", HttpStatus.ERROR); + } + DesTechnicalStandard deleteDocument = new DesTechnicalStandard(); + deleteDocument.setId(document.getId()); + deleteDocument.setDeletedAt(new Date()); + deleteDocument.setFileStatus(DocumentStatusEnum.DELETE.getValue()); + return this.updateById(deleteDocument); + } + + /** + * 批量删除质量知识库回收站文件信息 + * + * @param ids 待删除文件主键集合 + * @return 是否删除成功 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean deleteRecycleBinFileBatchByIds(Collection ids) { + Long userId = LoginHelper.getUserId(); + List documentList = this.listByIds(ids); + if (CollUtil.isEmpty(documentList)) { + throw new ServiceException("文件不存在", HttpStatus.ERROR); + } + Set projectIdList = documentList.stream().map(DesTechnicalStandard::getProjectId).collect(Collectors.toSet()); + projectService.validAuth(projectIdList, userId); + boolean result = this.removeBatchByIds(ids); + if (!result) { + throw new ServiceException("文件删除失败", HttpStatus.ERROR); + } + // 删除oss文件 + OssClient storage = OssFactory.instance(); + for (DesTechnicalStandard document : documentList) { + if (!document.getFileType().equals(DocumentTypeEnum.FOLDER.getValue())) { + storage.delete(document.getFileUrl()); + } + } + return true; + } + + /** + * 批量恢复质量会议纪要信息 + * + * @param ids 待删除的主键集合 + * @return 是否删除成功 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean recoveryBatchById(Collection ids) { + List allParentIdsRecursively = getAllParentIdsRecursively(ids); + // 需要更新状态的文件集合 + allParentIdsRecursively.addAll(ids); + List updateList = allParentIdsRecursively.stream().map(id -> { + DesTechnicalStandard documentSafetyMeeting = new DesTechnicalStandard(); + documentSafetyMeeting.setId(id); + documentSafetyMeeting.setFileStatus(DocumentStatusEnum.NORMAL.getValue()); + return documentSafetyMeeting; + }).toList(); + boolean result = this.updateBatchById(updateList); + if (!result) { + throw new ServiceException("恢复文件失败,数据库异常", HttpStatus.ERROR); + } + return true; + } + + /** + * 构建前端所需要下拉树结构 + * + * @param documentList 文档列表 + * @return 下拉树结构列表 + */ + @Override + public List> buildTreeSelect(List documentList) { + if (CollUtil.isEmpty(documentList)) { + return CollUtil.newArrayList(); + } + // 获取当前列表中每一个节点的parentId,然后在列表中查找是否有id与其parentId对应,若无对应,则表明此时节点列表中,该节点在当前列表中属于顶级节点 + List> treeList = CollUtil.newArrayList(); + for (DesTechnicalStandard d : documentList) { + Long parentId = d.getPid(); + DesTechnicalStandard document = StreamUtils.findFirst(documentList, it -> Objects.equals(it.getId(), parentId)); + if (ObjectUtil.isNull(document)) { + List> trees = TreeBuildUtils.build(documentList, parentId, (desTechnicalStandard, tree) -> + tree.setId(desTechnicalStandard.getId()) + .setParentId(desTechnicalStandard.getPid()) + .setName(desTechnicalStandard.getFileName())); + Tree tree = StreamUtils.findFirst(trees, it -> Objects.equals(it.getId(), d.getId())); + treeList.add(tree); + } + } + return treeList; + } + + /** + * 构建文档封装对象 + * + * @param document 文档 + * @return 文档封装对象 + */ + @Override + public DesTechnicalStandardVo getVo(DesTechnicalStandard document) { + DesTechnicalStandardVo vo = new DesTechnicalStandardVo(); + if (document == null) { + return vo; + } + BeanUtils.copyProperties(document, vo); + return vo; + } + + /** + * 获取文档对象视图 + * + * @param documentPage 文档对象 + * @return 文档对象视图 + */ + @Override + public Page getVoPage(Page documentPage) { + List documentList = documentPage.getRecords(); + Page documentVoPage = new Page<>( + documentPage.getCurrent(), + documentPage.getSize(), + documentPage.getTotal()); + if (CollUtil.isEmpty(documentList)) { + return documentVoPage; + } + List documentVoList = documentList.stream().map(entity -> { + DesTechnicalStandardVo documentVo = new DesTechnicalStandardVo(); + BeanUtils.copyProperties(entity, documentVo); + return documentVo; + }).toList(); + documentVoPage.setRecords(documentVoList); + return documentVoPage; + } + + /** + * 畅写在线文件修改 + * + * @param id 文档id + * @param request 请求 + * @param response 响应 + */ + @Override + public void singleFileUploads(Long id, HttpServletRequest request, HttpServletResponse response) { + try { + PrintWriter writer = response.getWriter(); + Scanner scanner = new Scanner(request.getInputStream(), "GBK").useDelimiter("\\A"); + String body = scanner.hasNext() ? scanner.next() : ""; + JSONObject jsonObj = JSONUtil.parseObj(body); + if (jsonObj.getInt("status") == 2 || jsonObj.getInt("status") == 6) { + String downloadUri = (String) jsonObj.get("url"); + DesTechnicalStandard document = this.getById(id); + String filePath = document.getFilePath(); + ossService.uploadFileUrlWithNoSave(downloadUri, filePath); + } else if (jsonObj.getInt("status") == 3 || jsonObj.getInt("status") == 7) { + writer.write("{\"error\":-1}"); + } + writer.write("{\"error\":0}"); + } catch (IOException e) { + throw new ServiceException("质量知识库在线修改文件失败," + e); + } + } + + /** + * 校验父级目录是否存在 + * + * @param desTechnicalStandard 父级目录 + * @param projectId 当前项目id + */ + private void validParentFolder(DesTechnicalStandard desTechnicalStandard, Long projectId) { + // 判断父级目录是否存在 + if (desTechnicalStandard == null) { + throw new ServiceException("父级目录不存在", HttpStatus.NOT_FOUND); + } + // 判断父级目录是否是文件夹 + if (!DocumentTypeEnum.FOLDER.getValue().equals(desTechnicalStandard.getFileType())) { + throw new ServiceException("父级目录不是文件夹", HttpStatus.BAD_REQUEST); + } + // 判断是否为同一个项目 + if (!desTechnicalStandard.getProjectId().equals(projectId)) { + throw new ServiceException("父级目录不属于当前项目", HttpStatus.BAD_REQUEST); + } + } + + /** + * 递归查询所有父级 id + * + * @param ids id 列表 + * @return 父级 id 列表 + */ + private List getAllParentIdsRecursively(Collection ids) { + // 使用 list() 方法批量查询当前 id 列表对应的实体数据 + List fileList = this.lambdaQuery() + .in(DesTechnicalStandard::getId, ids) + .eq(DesTechnicalStandard::getFileStatus, DocumentStatusEnum.DELETE.getValue()) + .list(); + // 通过 stream 流过滤出非 0 的父 id,并去重 + List parentIdList = fileList.stream() + .map(DesTechnicalStandard::getPid) + .filter(pid -> pid != 0) + .distinct() + .collect(Collectors.toList()); + // 如果父 id 列表为空,说明递归终止,返回空列表 + if (parentIdList.isEmpty()) { + return new ArrayList<>(); + } + // 递归查询父 id 列表对应的上级父 id + List higherParentIds = getAllParentIdsRecursively(parentIdList); + // 将当前层的父 id 和上级递归得到的父 id 合并 + List allParentIds = new ArrayList<>(); + allParentIds.addAll(parentIdList); + allParentIds.addAll(higherParentIds); + // 返回合并后去重的结果 + return allParentIds.stream().distinct().collect(Collectors.toList()); + } +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/controller/QltKnowledgeDocumentController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/controller/QltKnowledgeDocumentController.java index 2f8f1e38..73a38a03 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/controller/QltKnowledgeDocumentController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/controller/QltKnowledgeDocumentController.java @@ -13,10 +13,10 @@ import org.dromara.common.log.enums.BusinessType; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.web.core.BaseController; -import org.dromara.quality.domain.dto.knowledgedocument.QltKnowledgeDocumentCreateFileReq; +import org.dromara.quality.domain.dto.knowledgedocument.QltKnowledgeDocumentFileCreateReq; import org.dromara.quality.domain.dto.knowledgedocument.QltKnowledgeDocumentFileQueryReq; import org.dromara.quality.domain.dto.knowledgedocument.QltKnowledgeDocumentQueryReq; -import org.dromara.quality.domain.dto.knowledgedocument.QltKnowledgeDocumentUpdateFileReq; +import org.dromara.quality.domain.dto.knowledgedocument.QltKnowledgeDocumentFileUpdateReq; import org.dromara.quality.domain.vo.knowledgedocument.QltKnowledgeDocumentVo; import org.dromara.quality.service.IQltKnowledgeDocumentService; import org.springframework.validation.annotation.Validated; @@ -96,7 +96,7 @@ public class QltKnowledgeDocumentController extends BaseController { @Log(title = "质量知识库", businessType = BusinessType.INSERT) @RepeatSubmit() @PostMapping("/file") - public R add(@RequestPart("file") MultipartFile file, QltKnowledgeDocumentCreateFileReq req) { + public R add(@RequestPart("file") MultipartFile file, QltKnowledgeDocumentFileCreateReq req) { return toAjax(qltKnowledgeDocumentService.insertFile(file, req)); } @@ -107,7 +107,7 @@ public class QltKnowledgeDocumentController extends BaseController { @Log(title = "质量知识库", businessType = BusinessType.UPDATE) @RepeatSubmit() @PutMapping("/file") - public R edit(@RequestBody QltKnowledgeDocumentUpdateFileReq req) { + public R edit(@RequestBody QltKnowledgeDocumentFileUpdateReq req) { return toAjax(qltKnowledgeDocumentService.updateFile(req)); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/bo/QltKnowledgeDocumentBo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/bo/QltKnowledgeDocumentBo.java deleted file mode 100644 index 89fc63ca..00000000 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/bo/QltKnowledgeDocumentBo.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.dromara.quality.domain.bo; - -import org.dromara.quality.domain.QltKnowledgeDocument; -import org.dromara.common.mybatis.core.domain.BaseEntity; -import org.dromara.common.core.validate.AddGroup; -import org.dromara.common.core.validate.EditGroup; -import io.github.linpeilie.annotations.AutoMapper; -import lombok.Data; -import lombok.EqualsAndHashCode; -import jakarta.validation.constraints.*; -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; - -/** - * 质量知识库业务对象 qlt_knowledge_document - * - * @author lcj - * @date 2025-06-25 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@AutoMapper(target = QltKnowledgeDocument.class, reverseConvertGenerate = false) -public class QltKnowledgeDocumentBo extends BaseEntity { - - /** - * 主键id - */ - @NotNull(message = "主键id不能为空", groups = { EditGroup.class }) - private Long id; - - /** - * 项目id - */ - @NotNull(message = "项目id不能为空", groups = { AddGroup.class, EditGroup.class }) - private Long projectId; - - /** - * 父级(0代表顶级) - */ - @NotNull(message = "父级(0代表顶级)不能为空", groups = { AddGroup.class, EditGroup.class }) - private Long pid; - - /** - * 文件名称 - */ - @NotBlank(message = "文件名称不能为空", groups = { AddGroup.class, EditGroup.class }) - private String fileName; - - /** - * 文件路径 - */ - private String filePath; - - /** - * 文件访问路径 - */ - private String fileUrl; - - /** - * 文件类型(1文件夹 2文件 3图片) - */ - @NotBlank(message = "文件类型(1文件夹 2文件 3图片)不能为空", groups = { AddGroup.class, EditGroup.class }) - private String fileType; - - /** - * 文件后缀 - */ - private String fileSuffix; - - /** - * 状态(0正常 1删除) - */ - @NotBlank(message = "状态(0正常 1删除)不能为空", groups = { AddGroup.class, EditGroup.class }) - private String fileStatus; - - /** - * 原文件名 - */ - private String originalName; - - /** - * 备注 - */ - private String remark; - - -} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/dto/knowledgedocument/QltKnowledgeDocumentCreateFileReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/dto/knowledgedocument/QltKnowledgeDocumentFileCreateReq.java similarity index 88% rename from xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/dto/knowledgedocument/QltKnowledgeDocumentCreateFileReq.java rename to xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/dto/knowledgedocument/QltKnowledgeDocumentFileCreateReq.java index 3e0d3653..b78d3108 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/dto/knowledgedocument/QltKnowledgeDocumentCreateFileReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/dto/knowledgedocument/QltKnowledgeDocumentFileCreateReq.java @@ -10,7 +10,7 @@ import java.io.Serializable; * @date 2025/6/26 18:43 */ @Data -public class QltKnowledgeDocumentCreateFileReq implements Serializable { +public class QltKnowledgeDocumentFileCreateReq implements Serializable { @Serial private static final long serialVersionUID = 2209500240715662744L; diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/dto/knowledgedocument/QltKnowledgeDocumentUpdateFileReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/dto/knowledgedocument/QltKnowledgeDocumentFileUpdateReq.java similarity index 89% rename from xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/dto/knowledgedocument/QltKnowledgeDocumentUpdateFileReq.java rename to xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/dto/knowledgedocument/QltKnowledgeDocumentFileUpdateReq.java index 08529f0e..af9b6820 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/dto/knowledgedocument/QltKnowledgeDocumentUpdateFileReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/dto/knowledgedocument/QltKnowledgeDocumentFileUpdateReq.java @@ -10,7 +10,7 @@ import java.io.Serializable; * @date 2025/6/26 18:44 */ @Data -public class QltKnowledgeDocumentUpdateFileReq implements Serializable { +public class QltKnowledgeDocumentFileUpdateReq implements Serializable { @Serial private static final long serialVersionUID = -2002756179428078203L; diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/vo/knowledgedocument/QltKnowledgeDocumentVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/vo/knowledgedocument/QltKnowledgeDocumentVo.java index 3330f117..1042f0aa 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/vo/knowledgedocument/QltKnowledgeDocumentVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/vo/knowledgedocument/QltKnowledgeDocumentVo.java @@ -1,11 +1,7 @@ package org.dromara.quality.domain.vo.knowledgedocument; -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; -import com.alibaba.excel.annotation.ExcelProperty; import io.github.linpeilie.annotations.AutoMapper; import lombok.Data; -import org.dromara.common.excel.annotation.ExcelDictFormat; -import org.dromara.common.excel.convert.ExcelDictConvert; import org.dromara.quality.domain.QltKnowledgeDocument; import java.io.Serial; @@ -20,7 +16,6 @@ import java.util.Date; * @date 2025-06-25 */ @Data -@ExcelIgnoreUnannotated @AutoMapper(target = QltKnowledgeDocument.class) public class QltKnowledgeDocumentVo implements Serializable { @@ -30,77 +25,61 @@ public class QltKnowledgeDocumentVo implements Serializable { /** * 主键id */ - @ExcelProperty(value = "主键id") private Long id; /** * 项目id */ - @ExcelProperty(value = "项目id") private Long projectId; /** * 父级(0代表顶级) */ - @ExcelProperty(value = "父级", converter = ExcelDictConvert.class) - @ExcelDictFormat(readConverterExp = "0=代表顶级") private Long pid; /** * 文件名称 */ - @ExcelProperty(value = "文件名称") private String fileName; /** * 文件路径 */ - @ExcelProperty(value = "文件路径") private String filePath; /** * 文件访问路径 */ - @ExcelProperty(value = "文件访问路径") private String fileUrl; /** * 文件类型(1文件夹 2文件 3图片) */ - @ExcelProperty(value = "文件类型", converter = ExcelDictConvert.class) - @ExcelDictFormat(readConverterExp = "1=文件夹,2=文件,3=图片") private String fileType; /** * 文件后缀 */ - @ExcelProperty(value = "文件后缀") private String fileSuffix; /** * 状态(0正常 1删除) */ - @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) - @ExcelDictFormat(readConverterExp = "0=正常,1=删除") private String fileStatus; /** * 原文件名 */ - @ExcelProperty(value = "原文件名") private String originalName; /** * 备注 */ - @ExcelProperty(value = "备注") private String remark; /** * 创建时间 */ - @ExcelProperty(value = "创建时间") private Date createTime; - } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/service/IQltKnowledgeDocumentService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/service/IQltKnowledgeDocumentService.java index 38e36334..6f912c30 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/service/IQltKnowledgeDocumentService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/service/IQltKnowledgeDocumentService.java @@ -8,10 +8,10 @@ import jakarta.servlet.http.HttpServletResponse; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.quality.domain.QltKnowledgeDocument; -import org.dromara.quality.domain.dto.knowledgedocument.QltKnowledgeDocumentCreateFileReq; +import org.dromara.quality.domain.dto.knowledgedocument.QltKnowledgeDocumentFileCreateReq; import org.dromara.quality.domain.dto.knowledgedocument.QltKnowledgeDocumentFileQueryReq; import org.dromara.quality.domain.dto.knowledgedocument.QltKnowledgeDocumentQueryReq; -import org.dromara.quality.domain.dto.knowledgedocument.QltKnowledgeDocumentUpdateFileReq; +import org.dromara.quality.domain.dto.knowledgedocument.QltKnowledgeDocumentFileUpdateReq; import org.dromara.quality.domain.vo.knowledgedocument.QltKnowledgeDocumentVo; import org.springframework.web.multipart.MultipartFile; @@ -75,7 +75,7 @@ public interface IQltKnowledgeDocumentService extends IService add(@RequestPart("file") MultipartFile file, HseKnowledgeDocumentCreateFileReq req) { + public R add(@RequestPart("file") MultipartFile file, HseKnowledgeDocumentFileCreateReq req) { return toAjax(hseKnowledgeDocumentService.insertFile(file, req)); } @@ -107,7 +107,7 @@ public class HseKnowledgeDocumentController extends BaseController { @Log(title = "安全知识库", businessType = BusinessType.UPDATE) @RepeatSubmit() @PutMapping("/file") - public R edit(@RequestBody HseKnowledgeDocumentUpdateFileReq req) { + public R edit(@RequestBody HseKnowledgeDocumentFileUpdateReq req) { return toAjax(hseKnowledgeDocumentService.updateFile(req)); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/knowledgedocument/HseKnowledgeDocumentCreateFileReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/knowledgedocument/HseKnowledgeDocumentFileCreateReq.java similarity index 88% rename from xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/knowledgedocument/HseKnowledgeDocumentCreateFileReq.java rename to xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/knowledgedocument/HseKnowledgeDocumentFileCreateReq.java index 3f13b66b..a1037691 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/knowledgedocument/HseKnowledgeDocumentCreateFileReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/knowledgedocument/HseKnowledgeDocumentFileCreateReq.java @@ -10,7 +10,7 @@ import java.io.Serializable; * @date 2025/6/26 11:39 */ @Data -public class HseKnowledgeDocumentCreateFileReq implements Serializable { +public class HseKnowledgeDocumentFileCreateReq implements Serializable { @Serial private static final long serialVersionUID = 4262046408641303686L; diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/knowledgedocument/HseKnowledgeDocumentUpdateFileReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/knowledgedocument/HseKnowledgeDocumentFileUpdateReq.java similarity index 89% rename from xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/knowledgedocument/HseKnowledgeDocumentUpdateFileReq.java rename to xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/knowledgedocument/HseKnowledgeDocumentFileUpdateReq.java index 2bb7fe46..c90e5139 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/knowledgedocument/HseKnowledgeDocumentUpdateFileReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/knowledgedocument/HseKnowledgeDocumentFileUpdateReq.java @@ -10,7 +10,7 @@ import java.io.Serializable; * @date 2025/6/26 11:43 */ @Data -public class HseKnowledgeDocumentUpdateFileReq implements Serializable { +public class HseKnowledgeDocumentFileUpdateReq implements Serializable { @Serial private static final long serialVersionUID = -7715282474964511324L; diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/IHseKnowledgeDocumentService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/IHseKnowledgeDocumentService.java index 40e1e7f9..d3b904c2 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/IHseKnowledgeDocumentService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/IHseKnowledgeDocumentService.java @@ -8,10 +8,10 @@ import jakarta.servlet.http.HttpServletResponse; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.safety.domain.HseKnowledgeDocument; -import org.dromara.safety.domain.dto.knowledgedocument.HseKnowledgeDocumentCreateFileReq; +import org.dromara.safety.domain.dto.knowledgedocument.HseKnowledgeDocumentFileCreateReq; import org.dromara.safety.domain.dto.knowledgedocument.HseKnowledgeDocumentFileQueryReq; import org.dromara.safety.domain.dto.knowledgedocument.HseKnowledgeDocumentQueryReq; -import org.dromara.safety.domain.dto.knowledgedocument.HseKnowledgeDocumentUpdateFileReq; +import org.dromara.safety.domain.dto.knowledgedocument.HseKnowledgeDocumentFileUpdateReq; import org.dromara.safety.domain.vo.knowledgedocument.HseKnowledgeDocumentVo; import org.springframework.web.multipart.MultipartFile; @@ -75,7 +75,7 @@ public interface IHseKnowledgeDocumentService extends IService + + + + diff --git a/xinnengyuan/script/sql/xinnengyuan.sql b/xinnengyuan/script/sql/xinnengyuan.sql index 906721a2..360aacc1 100644 --- a/xinnengyuan/script/sql/xinnengyuan.sql +++ b/xinnengyuan/script/sql/xinnengyuan.sql @@ -1338,3 +1338,26 @@ CREATE TABLE `sub_contractor_material_record` index `idx_contractor_id` (`contractor_id` asc) using btree comment '分包方id', index `idx_contractor_material_id` (`contractor_material_id` asc) using btree comment '物料id' ) comment = '分包方物料记录' collate = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `des_technical_standard`; +CREATE TABLE `des_technical_standard` +( + `id` bigint not null auto_increment comment '主键id', + `project_id` bigint not null comment '项目id', + `pid` bigint default 0 not null comment '父级(0代表顶级)', + `file_name` varchar(255) not null comment '文件名称', + `file_path` varchar(512) null comment '文件路径', + `file_url` varchar(512) null comment '文件访问路径', + `file_type` char(1) not null comment '文件类型(1文件夹 2文件 3图片)', + `file_suffix` varchar(20) null comment '文件后缀', + `file_status` char(1) default '0' not null comment '状态(0正常 1删除)', + `original_name` varchar(255) null comment '原文件名', + `remark` varchar(512) null comment '备注', + `create_by` varchar(64) null comment '创建者', + `update_by` varchar(64) null comment '更新者', + `create_time` datetime default CURRENT_TIMESTAMP null comment '创建时间', + `update_time` datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间', + `deleted_at` datetime null comment '删除时间', + primary key (`id`) using btree, + index `idx_project_id` (`project_id` asc) using btree comment '项目id' +) comment '技术管理标准文档' collate = utf8mb4_unicode_ci;