feat:新增文档模板管理功能

This commit is contained in:
hewencai
2025-10-29 10:57:45 +08:00
parent 3ef662e1ec
commit 66845dcfab
41 changed files with 2440 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
package com.zt.plat.module.base.controller.admin.doctemplate;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateCategoryPageReqVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateCategoryRespVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateCategorySaveReqVO;
import com.zt.plat.module.base.service.doctemplate.DocTemplateCategoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
/**
* 模板分类 Controller
*
* @author 系统生成
*/
@Tag(name = "管理后台 - 模板分类")
@RestController
@RequestMapping("/base/doc-template-category")
@Validated
public class DocTemplateCategoryController {
@Resource
private DocTemplateCategoryService templateCategoryService;
@PostMapping("/create")
@Operation(summary = "创建模板分类")
@PreAuthorize("@ss.hasPermission('base:template-category:create')")
public CommonResult<Long> createTemplateCategory(@Valid @RequestBody DocTemplateCategorySaveReqVO createReqVO) {
return success(templateCategoryService.createTemplateCategory(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新模板分类")
@PreAuthorize("@ss.hasPermission('base:template-category:update')")
public CommonResult<Boolean> updateTemplateCategory(@Valid @RequestBody DocTemplateCategorySaveReqVO updateReqVO) {
templateCategoryService.updateTemplateCategory(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除模板分类")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:template-category:delete')")
public CommonResult<Boolean> deleteTemplateCategory(@RequestParam("id") Long id) {
templateCategoryService.deleteTemplateCategory(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得模板分类")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:template-category:query')")
public CommonResult<DocTemplateCategoryRespVO> getTemplateCategory(@RequestParam("id") Long id) {
return success(templateCategoryService.getTemplateCategory(id));
}
@GetMapping("/page")
@Operation(summary = "获得模板分类分页")
@PreAuthorize("@ss.hasPermission('base:template-category:query')")
public CommonResult<PageResult<DocTemplateCategoryRespVO>> getTemplateCategoryPage(@Valid DocTemplateCategoryPageReqVO pageReqVO) {
return success(templateCategoryService.getTemplateCategoryPage(pageReqVO));
}
@GetMapping("/list")
@Operation(summary = "获得模板分类列表")
@PreAuthorize("@ss.hasPermission('base:template-category:query')")
public CommonResult<List<DocTemplateCategoryRespVO>> getTemplateCategoryList() {
return success(templateCategoryService.getTemplateCategoryList());
}
@GetMapping("/tree")
@Operation(summary = "获得模板分类树形结构")
@PreAuthorize("@ss.hasPermission('base:template-category:query')")
public CommonResult<List<DocTemplateCategoryRespVO>> getTemplateCategoryTree() {
return success(templateCategoryService.buildTree());
}
}

View File

@@ -0,0 +1,82 @@
package com.zt.plat.module.base.controller.admin.doctemplate;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplatePageReqVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateRespVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateSaveReqVO;
import com.zt.plat.module.base.service.doctemplate.DocTemplateService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
/**
* 模板 Controller
*
* @author 系统生成
*/
@Tag(name = "管理后台 - 模板")
@RestController
@RequestMapping("/base/doc-template")
@Validated
public class DocTemplateController {
@Resource
private DocTemplateService templateService;
@PostMapping("/create")
@Operation(summary = "创建模板")
@PreAuthorize("@ss.hasPermission('base:template:create')")
public CommonResult<Long> createTemplate(@Valid @RequestBody DocTemplateSaveReqVO createReqVO) {
return success(templateService.createTemplate(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新模板")
@PreAuthorize("@ss.hasPermission('base:template:update')")
public CommonResult<Boolean> updateTemplate(@Valid @RequestBody DocTemplateSaveReqVO updateReqVO) {
templateService.updateTemplate(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除模板")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:template:delete')")
public CommonResult<Boolean> deleteTemplate(@RequestParam("id") Long id) {
templateService.deleteTemplate(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得模板")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:template:query')")
public CommonResult<DocTemplateRespVO> getTemplate(@RequestParam("id") Long id) {
return success(templateService.getTemplate(id));
}
@GetMapping("/page")
@Operation(summary = "获得模板分页")
@PreAuthorize("@ss.hasPermission('base:template:query')")
public CommonResult<PageResult<DocTemplateRespVO>> getTemplatePage(@Valid DocTemplatePageReqVO pageReqVO) {
return success(templateService.getTemplatePage(pageReqVO));
}
@GetMapping("/list")
@Operation(summary = "获得模板列表")
@PreAuthorize("@ss.hasPermission('base:template:query')")
public CommonResult<List<DocTemplateRespVO>> getTemplateList() {
return success(templateService.getTemplateList());
}
}

View File

@@ -0,0 +1,82 @@
package com.zt.plat.module.base.controller.admin.doctemplate;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateTagPageReqVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateTagRespVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateTagSaveReqVO;
import com.zt.plat.module.base.service.doctemplate.DocTemplateTagService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
/**
* 标签库 Controller
*
* @author 系统生成
*/
@Tag(name = "管理后台 - 标签库")
@RestController
@RequestMapping("/base/doc-template-tag")
@Validated
public class DocTemplateTagController {
@Resource
private DocTemplateTagService templateTagService;
@PostMapping("/create")
@Operation(summary = "创建标签")
@PreAuthorize("@ss.hasPermission('base:template-tag:create')")
public CommonResult<Long> createTemplateTag(@Valid @RequestBody DocTemplateTagSaveReqVO createReqVO) {
return success(templateTagService.createTemplateTag(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新标签")
@PreAuthorize("@ss.hasPermission('base:template-tag:update')")
public CommonResult<Boolean> updateTemplateTag(@Valid @RequestBody DocTemplateTagSaveReqVO updateReqVO) {
templateTagService.updateTemplateTag(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除标签")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:template-tag:delete')")
public CommonResult<Boolean> deleteTemplateTag(@RequestParam("id") Long id) {
templateTagService.deleteTemplateTag(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得标签")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:template-tag:query')")
public CommonResult<DocTemplateTagRespVO> getTemplateTag(@RequestParam("id") Long id) {
return success(templateTagService.getTemplateTag(id));
}
@GetMapping("/page")
@Operation(summary = "获得标签分页")
@PreAuthorize("@ss.hasPermission('base:template-tag:query')")
public CommonResult<PageResult<DocTemplateTagRespVO>> getTemplateTagPage(@Valid DocTemplateTagPageReqVO pageReqVO) {
return success(templateTagService.getTemplateTagPage(pageReqVO));
}
@GetMapping("/list")
@Operation(summary = "获得标签列表")
@PreAuthorize("@ss.hasPermission('base:template-tag:query')")
public CommonResult<List<DocTemplateTagRespVO>> getTemplateTagList() {
return success(templateTagService.getTemplateTagList());
}
}

View File

@@ -0,0 +1,27 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import com.zt.plat.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 模板分类分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DocTemplateCategoryPageReqVO extends PageParam {
@Schema(description = "分类名称", example = "采购类")
private String categoryName;
@Schema(description = "分类编码", example = "PURCHASE")
private String categoryCode;
@Schema(description = "父分类ID", example = "1")
private Long parentId;
@Schema(description = "层级1=大类2=小类)", example = "1")
private Integer level;
}

View File

@@ -0,0 +1,43 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - 模板分类 Response VO")
@Data
public class DocTemplateCategoryRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "采购类")
private String categoryName;
@Schema(description = "分类编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "PURCHASE")
private String categoryCode;
@Schema(description = "父分类ID", example = "1")
private Long parentId;
@Schema(description = "层级1=大类2=小类)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer level;
@Schema(description = "排序号", example = "1")
private Integer sort;
@Schema(description = "备注", example = "采购业务相关文档分类")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
@Schema(description = "创建人", example = "admin")
private String creator;
@Schema(description = "子分类列表")
private List<DocTemplateCategoryRespVO> children;
}

View File

@@ -0,0 +1,37 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
@Schema(description = "管理后台 - 模板分类新增/修改 Request VO")
@Data
public class DocTemplateCategorySaveReqVO {
@Schema(description = "主键", example = "1024")
private Long id;
@Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "采购类")
@NotBlank(message = "分类名称不能为空")
private String categoryName;
@Schema(description = "分类编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "PURCHASE")
@NotBlank(message = "分类编码不能为空")
private String categoryCode;
@Schema(description = "父分类ID", example = "1")
private Long parentId;
@Schema(description = "层级1=大类2=小类)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "层级不能为空")
private Integer level;
@Schema(description = "排序号", example = "1")
private Integer sort;
@Schema(description = "备注", example = "采购业务相关文档分类")
private String remark;
}

View File

@@ -0,0 +1,36 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import com.zt.plat.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 模板实例分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DocTemplateInstancePageReqVO extends PageParam {
@Schema(description = "实例名称", example = "采购合同")
private String instanceName;
@Schema(description = "模板ID", example = "1")
private Long templateId;
@Schema(description = "业务关联类型", example = "contract")
private String businessType;
@Schema(description = "状态", example = "draft")
private String status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,51 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 模板实例 Response VO")
@Data
public class DocTemplateInstanceRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "实例名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "2025年上海XX供应商采购合同")
private String instanceName;
@Schema(description = "实例编码", example = "DOC-20250127-001")
private String instanceCode;
@Schema(description = "引用的模板ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long templateId;
@Schema(description = "业务关联类型", example = "contract")
private String businessType;
@Schema(description = "业务关联ID", example = "100")
private Long businessId;
@Schema(description = "业务关联标签", example = "PC-2025-001")
private String businessLabel;
@Schema(description = "用户编辑后的内容")
private String editedContent;
@Schema(description = "渲染后的最终内容")
private String renderedContent;
@Schema(description = "备注", example = "采购合同文档")
private String remark;
@Schema(description = "状态", example = "draft")
private String status;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
@Schema(description = "创建人", example = "admin")
private String creator;
}

View File

@@ -0,0 +1,49 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
@Schema(description = "管理后台 - 模板实例新增/修改 Request VO")
@Data
public class DocTemplateInstanceSaveReqVO {
@Schema(description = "主键", example = "1024")
private Long id;
@Schema(description = "实例名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "2025年上海XX供应商采购合同")
@NotBlank(message = "实例名称不能为空")
private String instanceName;
@Schema(description = "实例编码", example = "DOC-20250127-001")
private String instanceCode;
@Schema(description = "引用的模板ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "模板ID不能为空")
private Long templateId;
@Schema(description = "业务关联类型", example = "contract")
private String businessType;
@Schema(description = "业务关联ID", example = "100")
private Long businessId;
@Schema(description = "业务关联标签", example = "PC-2025-001")
private String businessLabel;
@Schema(description = "用户编辑后的内容", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "内容不能为空")
private String editedContent;
@Schema(description = "渲染后的最终内容")
private String renderedContent;
@Schema(description = "备注", example = "采购合同文档")
private String remark;
@Schema(description = "状态", example = "draft")
private String status;
}

Some files were not shown because too many files have changed in this diff Show More