Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -6,6 +6,13 @@ public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 示例模块 1-001-000-000 ==========
|
||||
ErrorCode TMPL_TP_NOT_EXISTS = new ErrorCode(1_027_000_500, "模板分类不存在");
|
||||
ErrorCode TMPL_FLD_NOT_EXISTS = new ErrorCode(1_027_000_501, "模板字段不存在");
|
||||
ErrorCode TMPL_FLD_CODE_EXISTS = new ErrorCode(1_027_000_502, "字段编码已存在");
|
||||
ErrorCode TMPL_ITM_NOT_EXISTS = new ErrorCode(1_027_000_503, "模板条款不存在");
|
||||
ErrorCode TEMPLATE_INSTANCE_NOT_EXISTS = new ErrorCode(1_027_000_504, "模板实例不存在");
|
||||
ErrorCode TMPL_TP_SATUS_ERROR = new ErrorCode(1_027_000_506, "状态变更失败");
|
||||
ErrorCode TMPL_TP_DEl_ERROR = new ErrorCode(1_027_000_507, "模版分类删除失败");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package cn.iocoder.yudao.module.tmpltp.enums;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 状态枚举类,定义所有可能的状态及合法的状态转换
|
||||
*/
|
||||
public enum StatusEnum {
|
||||
// 定义所有状态及对应的合法转换目标状态
|
||||
STATUS_1("1", new HashSet<String>() {{
|
||||
add("2");
|
||||
add("4");
|
||||
}}),
|
||||
STATUS_2("2", new HashSet<String>() {{
|
||||
add("3");
|
||||
}}),
|
||||
STATUS_3("3", new HashSet<String>() {{
|
||||
add("4");
|
||||
add("2");
|
||||
}}),
|
||||
STATUS_4("4", new HashSet<>()); // 没有合法的转换目标
|
||||
|
||||
private final String code;
|
||||
private final Set<String> allowedTransitions;
|
||||
|
||||
StatusEnum(String code, Set<String> allowedTransitions) {
|
||||
this.code = code;
|
||||
this.allowedTransitions = allowedTransitions;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态码获取对应的枚举实例
|
||||
*/
|
||||
public static StatusEnum fromCode(String code) {
|
||||
for (StatusEnum status : values()) {
|
||||
if (status.code.equals(code)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验状态转换是否合法
|
||||
*/
|
||||
public boolean isTransitionAllowed(String targetStatus) {
|
||||
return allowedTransitions.contains(targetStatus);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import cn.iocoder.yudao.framework.business.annotation.FileUploadController;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmpItmPageReqVO;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmplItmRespVO;
|
||||
@@ -15,9 +16,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -29,34 +28,33 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
public class TmplItmController {
|
||||
private final TmplItmService tmplItmService;
|
||||
@RequestMapping("/create")
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建模板条款")
|
||||
public CommonResult<TmplItmRespVO> createTmplItm(@Valid @RequestBody TmplItmSaveReqVO createReqVO){
|
||||
TmplItmRespVO tmplItm = tmplItmService.createTmplItm(createReqVO);
|
||||
return success(tmplItm);
|
||||
}
|
||||
@RequestMapping("/update")
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新模板条款")
|
||||
public CommonResult<Boolean> updateTmplItm(@Valid @RequestBody TmplItmSaveReqVO updateReqVO){
|
||||
tmplItmService.updateTmplItm(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
@RequestMapping("/delete")
|
||||
@Operation(summary = "删除模板条款")
|
||||
public CommonResult<Boolean> deleteTmplItm(@RequestBody String ids){
|
||||
return success( tmplItmService.deleteTmplItm(ids));
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除模板条款", description = "")
|
||||
public CommonResult<Boolean> deleteTmplItm(@RequestBody BatchDeleteReqVO req){
|
||||
return success( tmplItmService.deleteTmplItm(req.getIds()));
|
||||
}
|
||||
@RequestMapping("/get")
|
||||
@GetMapping("/id")
|
||||
@Operation(summary = "根据id获得模板条款")
|
||||
public CommonResult<TmplItmRespVO> getTmplItm(@RequestBody String id){
|
||||
return success(BeanUtils.toBean(tmplItmService.getById(id), TmplItmRespVO.class));
|
||||
}
|
||||
@RequestMapping("/list")
|
||||
|
||||
@GetMapping("/list")
|
||||
public CommonResult<List<TmplItmRespVO>> listTmplItm(){
|
||||
return success(BeanUtils.toBean(tmplItmService.list(), TmplItmRespVO.class));
|
||||
}
|
||||
@RequestMapping("/page")
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "分页获得模板条款")
|
||||
public CommonResult<PageResult<TmplItmRespVO>> pageTmplItm(@Validated TmpItmPageReqVO pageReqVO){
|
||||
PageResult<TmplItmDO> pageResult = tmplItmService.pageTmplItm(pageReqVO);
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmplTpPageReqVO;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmplTpRespVO;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmplTpSaveReqVO;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmplTpTreeVO;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.*;
|
||||
import cn.iocoder.yudao.module.base.dal.dataobject.tmpltp.TmplTpDO;
|
||||
import cn.iocoder.yudao.module.base.service.tmpltp.TmplTpService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -67,8 +64,8 @@ public class TmplTpController extends AbstractFileUploadController implements Bu
|
||||
@Operation(summary = "删除模板分类")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp:delete')")
|
||||
public CommonResult<Boolean> deleteTmplTp(@RequestParam("id") Long id) {
|
||||
tmplTpService.deleteTmplTp(id);
|
||||
public CommonResult<Boolean> deleteTmplTp(@RequestBody BatchDeleteReqVO req) {
|
||||
tmplTpService.deleteTmplTp(req.getIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -111,8 +108,8 @@ public class TmplTpController extends AbstractFileUploadController implements Bu
|
||||
BeanUtils.toBean(list, TmplTpRespVO.class));
|
||||
}
|
||||
//字段和条款回显
|
||||
@GetMapping("/get-field-and-clause")
|
||||
@Operation(summary = "获得字段和条款")
|
||||
@GetMapping("/field-and-clause")
|
||||
@Operation(summary = "获得字段和条款",description = "字段和条款回显,传入模版分类的id")
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp:query')")
|
||||
public CommonResult<Map<String, Object>> getFieldAndClause(@RequestParam("id") Long id) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
@@ -122,10 +119,19 @@ public class TmplTpController extends AbstractFileUploadController implements Bu
|
||||
}
|
||||
//获取分类树
|
||||
@GetMapping("/tree")
|
||||
@Operation(summary = "获得分类树")
|
||||
@Operation(summary = "获得分类树--上级")
|
||||
public CommonResult<List<TmplTpTreeVO>> getTree() {
|
||||
List<TmplTpTreeVO> tree = tmplTpService.buildTree();
|
||||
return success(tree);
|
||||
}
|
||||
|
||||
//更新类型状态
|
||||
@PutMapping("/updateStatus")
|
||||
@Operation(summary = "更新模板字段状态")
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp:update')")
|
||||
public CommonResult<Boolean> updateStatus(@RequestBody TmplTpSaveReqVO updateReqVO) {
|
||||
tmplTpService.updateStatus(updateReqVO.getId(), updateReqVO.getSts());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.base.controller.admin.templtp;
|
||||
import cn.iocoder.yudao.framework.business.annotation.FileUploadController;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmplFldPageReqVO;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmplFldRespVO;
|
||||
@@ -18,6 +19,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@@ -29,31 +31,30 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
@RequiredArgsConstructor
|
||||
public class TmplTpFldController {
|
||||
private final TmplTpFldService tmplTpFldService;
|
||||
@RequestMapping("/create")
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建模板字段")
|
||||
// @PreAuthorize("@ss.hasPermission('bse:tmpl-tp:create')")
|
||||
// @PreAuthorize("@ss.hasPermission('bse:tmpl-tp-fld:create')")
|
||||
public CommonResult<TmplFldRespVO> createTmplFld(@Valid @RequestBody TmplTpFldSaveReqVO tmplTpFldSaveReqVO) {
|
||||
return success(tmplTpFldService.createTmplFld(tmplTpFldSaveReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新模板字段")
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp:update')")
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp-fld:update')")
|
||||
public CommonResult<Boolean> updateTmplTp(@Valid @RequestBody TmplTpFldSaveReqVO updateReqVO) {
|
||||
tmplTpFldService.updateTmplFld(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除模板字段")
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp:delete')")
|
||||
public CommonResult<Boolean> deleteTmplTp(@RequestParam("id") String id) {
|
||||
tmplTpFldService.removeById(id);
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp-fld:delete')")
|
||||
public CommonResult<Boolean> deleteTmplTp(@RequestBody BatchDeleteReqVO req) {
|
||||
tmplTpFldService.deleteTmplTpByIds(req.getIds());
|
||||
return success(true);
|
||||
}
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得模板字段列表")
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp:list')")
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp-fld:list')")
|
||||
public CommonResult<PageResult<TmplFldRespVO>> getTmplTpList( @Valid TmplFldPageReqVO pageReqVO) {
|
||||
PageResult<TmplTpFldDO> pageResult = tmplTpFldService.tmplTpFldPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, TmplFldRespVO.class));
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 模板实例分页 Request VO")
|
||||
@Data
|
||||
public class TemplateInstancePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "分类树主键", example = "7804")
|
||||
private Long typeId;
|
||||
|
||||
@Schema(description = "模板名称", example = "王五")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "模板编码")
|
||||
private String coding;
|
||||
|
||||
@Schema(description = "模板描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "实例文件内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "原始文件内容")
|
||||
private String originalContent;
|
||||
|
||||
@Schema(description = "文件类型", example = "1")
|
||||
private String fileType;
|
||||
|
||||
@Schema(description = "版本号;如v1.0")
|
||||
private String version;
|
||||
|
||||
@Schema(description = "状态", example = "2")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 模板实例 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class TemplateInstanceRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "29024")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "分类树主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "7804")
|
||||
@ExcelProperty("分类树主键")
|
||||
private Long typeId;
|
||||
|
||||
@Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@ExcelProperty("模板名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("模板编码")
|
||||
private String coding;
|
||||
|
||||
@Schema(description = "模板描述")
|
||||
@ExcelProperty("模板描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "实例文件内容")
|
||||
@ExcelProperty("实例文件内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "原始文件内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("原始文件内容")
|
||||
private String originalContent;
|
||||
|
||||
@Schema(description = "文件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("文件类型")
|
||||
private String fileType;
|
||||
|
||||
@Schema(description = "版本号;如v1.0", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("版本号;如v1.0")
|
||||
private String version;
|
||||
|
||||
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("状态")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 模板实例新增/修改 Request VO")
|
||||
@Data
|
||||
public class TemplateInstanceSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "29024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "分类树主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "7804")
|
||||
@NotNull(message = "分类树主键不能为空")
|
||||
private Long typeId;
|
||||
|
||||
@Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@NotEmpty(message = "模板名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "模板编码不能为空")
|
||||
private String coding;
|
||||
|
||||
@Schema(description = "模板描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "实例文件内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "原始文件内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "原始文件内容不能为空")
|
||||
private String originalContent;
|
||||
|
||||
@Schema(description = "文件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotEmpty(message = "文件类型不能为空")
|
||||
private String fileType;
|
||||
|
||||
@Schema(description = "版本号;如v1.0", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "版本号;如v1.0不能为空")
|
||||
private String version;
|
||||
|
||||
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotEmpty(message = "状态不能为空")
|
||||
private String status;
|
||||
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Schema(description = "管理后台 - 模板分类 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@@ -33,4 +35,13 @@ public class TmplItmRespVO {
|
||||
@Schema(description = "条款结构", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
|
||||
@ExcelProperty("条款结构")
|
||||
private String itmVal;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDate createTime;
|
||||
|
||||
|
||||
@Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建人")
|
||||
private String creator;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user