[add] 技术标准管理模块
This commit is contained in:
BIN
xinnengyuan/file/resource/design/main.exe
Normal file
BIN
xinnengyuan/file/resource/design/main.exe
Normal file
Binary file not shown.
@ -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
|
||||
|
@ -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<String> SECOND_LEVEL_FOLDER_NAME = List.of("设计输入条件", "设计原则", "业主需求清单");
|
||||
|
||||
/**
|
||||
* 图片后缀列表
|
||||
*/
|
||||
List<String> 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);
|
||||
}
|
||||
|
||||
}
|
@ -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<DesTechnicalStandardVo> queryFilePageList(DesTechnicalStandardFileQueryReq req, PageQuery pageQuery) {
|
||||
return desTechnicalStandardService.queryFilePageByFolderId(req, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询技术管理标准文件列表
|
||||
*/
|
||||
@SaCheckPermission("design:technicalStandard:list")
|
||||
@GetMapping("/file/list/{folderId}")
|
||||
public R<List<DesTechnicalStandardVo>> queryFileListByFolderId(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long folderId) {
|
||||
return R.ok(desTechnicalStandardService.queryFileListByFolderId(folderId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询技术管理标准文件树列表
|
||||
*/
|
||||
@SaCheckPermission("design:technicalStandard:list")
|
||||
@GetMapping("/folder/tree/list")
|
||||
public R<List<Tree<Long>>> queryFolderTreeList(DesTechnicalStandardQueryReq req) {
|
||||
List<Tree<Long>> list = desTechnicalStandardService.queryFolderTreeList(req);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询技术管理标准回收站文件列表
|
||||
*/
|
||||
@SaCheckPermission("design:technicalStandard:list")
|
||||
@GetMapping("/recycleBin/list")
|
||||
public TableDataInfo<DesTechnicalStandardVo> queryRecycleBinPageList(DesTechnicalStandardQueryReq req, PageQuery pageQuery) {
|
||||
return desTechnicalStandardService.queryRecycleBinPageList(req, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取技术管理标准详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("design:technicalStandard:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<DesTechnicalStandardVo> 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<Void> 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<Void> 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<Void> 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<Void> 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<Void> 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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<DesTechnicalStandard, DesTechnicalStandardVo> {
|
||||
|
||||
}
|
@ -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<DesTechnicalStandard> {
|
||||
|
||||
/**
|
||||
* 查询技术管理标准
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 技术管理标准
|
||||
*/
|
||||
DesTechnicalStandardVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询技术管理标准文件夹树列表
|
||||
*
|
||||
* @param req 查询参数
|
||||
* @return 技术管理标准文件夹树列表
|
||||
*/
|
||||
List<Tree<Long>> queryFolderTreeList(DesTechnicalStandardQueryReq req);
|
||||
|
||||
/**
|
||||
* 分页查询文件夹下的技术管理标准文件列表
|
||||
*
|
||||
* @param req 查询参数
|
||||
* @param pageQuery 分页参数
|
||||
* @return 技术管理标准文件列表
|
||||
*/
|
||||
TableDataInfo<DesTechnicalStandardVo> queryFilePageByFolderId(DesTechnicalStandardFileQueryReq req, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询文件夹下的技术管理标准文件列表
|
||||
*
|
||||
* @param folderId 文件夹id
|
||||
* @return 技术管理标准文件列表
|
||||
*/
|
||||
List<DesTechnicalStandardVo> queryFileListByFolderId(Long folderId);
|
||||
|
||||
/**
|
||||
* 查询回收站中的文件
|
||||
*
|
||||
* @param req 查询参数
|
||||
* @param pageQuery 分页参数
|
||||
* @return 回收站中的文件
|
||||
*/
|
||||
TableDataInfo<DesTechnicalStandardVo> 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<Long> ids);
|
||||
|
||||
/**
|
||||
* 批量恢复质量会议纪要信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean recoveryBatchById(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
* @param documentList 文档列表
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
List<Tree<Long>> buildTreeSelect(List<DesTechnicalStandard> documentList);
|
||||
|
||||
/**
|
||||
* 构建文档封装对象
|
||||
*
|
||||
* @param document 文档
|
||||
* @return 文档封装对象
|
||||
*/
|
||||
DesTechnicalStandardVo getVo(DesTechnicalStandard document);
|
||||
|
||||
/**
|
||||
* 获取文档对象视图
|
||||
*
|
||||
* @param documentPage 文档对象
|
||||
* @return 文档对象视图
|
||||
*/
|
||||
Page<DesTechnicalStandardVo> getVoPage(Page<DesTechnicalStandard> documentPage);
|
||||
|
||||
/**
|
||||
* 畅写在线文件修改
|
||||
*
|
||||
* @param id 文档id
|
||||
* @param request 请求
|
||||
* @param response 响应
|
||||
*/
|
||||
void singleFileUploads(Long id, HttpServletRequest request, HttpServletResponse response);
|
||||
}
|
@ -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<DesTechnicalStandardMapper, DesTechnicalStandard>
|
||||
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<Tree<Long>> queryFolderTreeList(DesTechnicalStandardQueryReq req) {
|
||||
Long projectId = req.getProjectId();
|
||||
List<DesTechnicalStandard> 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<DesTechnicalStandardVo> queryFilePageByFolderId(DesTechnicalStandardFileQueryReq req, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<DesTechnicalStandard> 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<DesTechnicalStandard> documentPage = this.page(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(this.getVoPage(documentPage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文件夹下的质量知识库文件列表
|
||||
*
|
||||
* @param folderId 文件夹id
|
||||
* @return 质量知识库文件列表
|
||||
*/
|
||||
@Override
|
||||
public List<DesTechnicalStandardVo> 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<DesTechnicalStandard> 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<DesTechnicalStandardVo> queryRecycleBinPageList(DesTechnicalStandardQueryReq req, PageQuery pageQuery) {
|
||||
Long projectId = req.getProjectId();
|
||||
if (projectService.getById(projectId) == null) {
|
||||
throw new ServiceException("项目不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
LambdaQueryWrapper<DesTechnicalStandard> 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<DesTechnicalStandard> 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<DesTechnicalStandard> 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<Long> ids) {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
List<DesTechnicalStandard> documentList = this.listByIds(ids);
|
||||
if (CollUtil.isEmpty(documentList)) {
|
||||
throw new ServiceException("文件不存在", HttpStatus.ERROR);
|
||||
}
|
||||
Set<Long> 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<Long> ids) {
|
||||
List<Long> allParentIdsRecursively = getAllParentIdsRecursively(ids);
|
||||
// 需要更新状态的文件集合
|
||||
allParentIdsRecursively.addAll(ids);
|
||||
List<DesTechnicalStandard> 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<Tree<Long>> buildTreeSelect(List<DesTechnicalStandard> documentList) {
|
||||
if (CollUtil.isEmpty(documentList)) {
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
// 获取当前列表中每一个节点的parentId,然后在列表中查找是否有id与其parentId对应,若无对应,则表明此时节点列表中,该节点在当前列表中属于顶级节点
|
||||
List<Tree<Long>> 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<Tree<Long>> trees = TreeBuildUtils.build(documentList, parentId, (desTechnicalStandard, tree) ->
|
||||
tree.setId(desTechnicalStandard.getId())
|
||||
.setParentId(desTechnicalStandard.getPid())
|
||||
.setName(desTechnicalStandard.getFileName()));
|
||||
Tree<Long> 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<DesTechnicalStandardVo> getVoPage(Page<DesTechnicalStandard> documentPage) {
|
||||
List<DesTechnicalStandard> documentList = documentPage.getRecords();
|
||||
Page<DesTechnicalStandardVo> documentVoPage = new Page<>(
|
||||
documentPage.getCurrent(),
|
||||
documentPage.getSize(),
|
||||
documentPage.getTotal());
|
||||
if (CollUtil.isEmpty(documentList)) {
|
||||
return documentVoPage;
|
||||
}
|
||||
List<DesTechnicalStandardVo> 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<Long> getAllParentIdsRecursively(Collection<Long> ids) {
|
||||
// 使用 list() 方法批量查询当前 id 列表对应的实体数据
|
||||
List<DesTechnicalStandard> fileList = this.lambdaQuery()
|
||||
.in(DesTechnicalStandard::getId, ids)
|
||||
.eq(DesTechnicalStandard::getFileStatus, DocumentStatusEnum.DELETE.getValue())
|
||||
.list();
|
||||
// 通过 stream 流过滤出非 0 的父 id,并去重
|
||||
List<Long> parentIdList = fileList.stream()
|
||||
.map(DesTechnicalStandard::getPid)
|
||||
.filter(pid -> pid != 0)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
// 如果父 id 列表为空,说明递归终止,返回空列表
|
||||
if (parentIdList.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 递归查询父 id 列表对应的上级父 id
|
||||
List<Long> higherParentIds = getAllParentIdsRecursively(parentIdList);
|
||||
// 将当前层的父 id 和上级递归得到的父 id 合并
|
||||
List<Long> allParentIds = new ArrayList<>();
|
||||
allParentIds.addAll(parentIdList);
|
||||
allParentIds.addAll(higherParentIds);
|
||||
// 返回合并后去重的结果
|
||||
return allParentIds.stream().distinct().collect(Collectors.toList());
|
||||
}
|
||||
}
|
@ -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<Void> add(@RequestPart("file") MultipartFile file, QltKnowledgeDocumentCreateFileReq req) {
|
||||
public R<Void> 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<Void> edit(@RequestBody QltKnowledgeDocumentUpdateFileReq req) {
|
||||
public R<Void> edit(@RequestBody QltKnowledgeDocumentFileUpdateReq req) {
|
||||
return toAjax(qltKnowledgeDocumentService.updateFile(req));
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
||||
}
|
@ -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;
|
@ -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;
|
@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
@ -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<QltKnowledgeDocum
|
||||
* @param req 质量知识库
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertFile(MultipartFile file, QltKnowledgeDocumentCreateFileReq req);
|
||||
Boolean insertFile(MultipartFile file, QltKnowledgeDocumentFileCreateReq req);
|
||||
|
||||
/**
|
||||
* 新增质量知识库文件夹
|
||||
@ -91,7 +91,7 @@ public interface IQltKnowledgeDocumentService extends IService<QltKnowledgeDocum
|
||||
* @param req 质量知识库
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateFile(QltKnowledgeDocumentUpdateFileReq req);
|
||||
Boolean updateFile(QltKnowledgeDocumentFileUpdateReq req);
|
||||
|
||||
/**
|
||||
* 删除质量知识库文件信息
|
||||
|
@ -26,10 +26,10 @@ import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.quality.constant.QltKnowledgeDocumentConstant;
|
||||
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.dromara.quality.mapper.QltKnowledgeDocumentMapper;
|
||||
import org.dromara.quality.service.IQltKnowledgeDocumentService;
|
||||
@ -175,7 +175,7 @@ public class QltKnowledgeDocumentServiceImpl extends ServiceImpl<QltKnowledgeDoc
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertFile(MultipartFile file, QltKnowledgeDocumentCreateFileReq req) {
|
||||
public Boolean insertFile(MultipartFile file, QltKnowledgeDocumentFileCreateReq req) {
|
||||
// 数据校验
|
||||
if (ObjectUtils.isEmpty(file)) {
|
||||
throw new ServiceException("文件不能为空", HttpStatus.BAD_REQUEST);
|
||||
@ -269,7 +269,7 @@ public class QltKnowledgeDocumentServiceImpl extends ServiceImpl<QltKnowledgeDoc
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateFile(QltKnowledgeDocumentUpdateFileReq req) {
|
||||
public Boolean updateFile(QltKnowledgeDocumentFileUpdateReq req) {
|
||||
Long id = req.getId();
|
||||
QltKnowledgeDocument oldDocument = this.getById(id);
|
||||
if (oldDocument == null) {
|
||||
|
@ -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.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.dromara.safety.service.IHseKnowledgeDocumentService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -96,7 +96,7 @@ public class HseKnowledgeDocumentController extends BaseController {
|
||||
@Log(title = "安全知识库", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/file")
|
||||
public R<Void> add(@RequestPart("file") MultipartFile file, HseKnowledgeDocumentCreateFileReq req) {
|
||||
public R<Void> 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<Void> edit(@RequestBody HseKnowledgeDocumentUpdateFileReq req) {
|
||||
public R<Void> edit(@RequestBody HseKnowledgeDocumentFileUpdateReq req) {
|
||||
return toAjax(hseKnowledgeDocumentService.updateFile(req));
|
||||
}
|
||||
|
||||
|
@ -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;
|
@ -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;
|
@ -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<HseKnowledgeDocum
|
||||
* @param req 安全知识库
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertFile(MultipartFile file, HseKnowledgeDocumentCreateFileReq req);
|
||||
Boolean insertFile(MultipartFile file, HseKnowledgeDocumentFileCreateReq req);
|
||||
|
||||
/**
|
||||
* 新增安全知识库文件夹
|
||||
@ -91,7 +91,7 @@ public interface IHseKnowledgeDocumentService extends IService<HseKnowledgeDocum
|
||||
* @param req 安全知识库
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateFile(HseKnowledgeDocumentUpdateFileReq req);
|
||||
Boolean updateFile(HseKnowledgeDocumentFileUpdateReq req);
|
||||
|
||||
/**
|
||||
* 删除安全知识库文件信息
|
||||
|
@ -27,10 +27,10 @@ import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.safety.constant.HseKnowledgeDocumentConstant;
|
||||
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.dromara.safety.mapper.HseKnowledgeDocumentMapper;
|
||||
import org.dromara.safety.service.IHseKnowledgeDocumentService;
|
||||
@ -176,7 +176,7 @@ public class HseKnowledgeDocumentServiceImpl extends ServiceImpl<HseKnowledgeDoc
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertFile(MultipartFile file, HseKnowledgeDocumentCreateFileReq req) {
|
||||
public Boolean insertFile(MultipartFile file, HseKnowledgeDocumentFileCreateReq req) {
|
||||
// 数据校验
|
||||
if (ObjectUtils.isEmpty(file)) {
|
||||
throw new ServiceException("文件不能为空", HttpStatus.BAD_REQUEST);
|
||||
@ -270,7 +270,7 @@ public class HseKnowledgeDocumentServiceImpl extends ServiceImpl<HseKnowledgeDoc
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateFile(HseKnowledgeDocumentUpdateFileReq req) {
|
||||
public Boolean updateFile(HseKnowledgeDocumentFileUpdateReq req) {
|
||||
Long id = req.getId();
|
||||
HseKnowledgeDocument oldDocument = this.getById(id);
|
||||
if (oldDocument == null) {
|
||||
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.design.mapper.DesTechnicalStandardMapper">
|
||||
|
||||
</mapper>
|
@ -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;
|
||||
|
Reference in New Issue
Block a user