From de34430db762802e9a1257516eb3800fed4a3f60 Mon Sep 17 00:00:00 2001 From: DaxPay Dev Date: Sat, 27 Jun 2026 22:56:00 +0800 Subject: [PATCH] =?UTF-8?q?feat(perm):=20=E8=A1=A5=E5=85=85=20Protocol/Per?= =?UTF-8?q?mCode=20Controller=20=E7=BC=BA=E5=A4=B1=E7=9A=84=20@PermCode=20?= =?UTF-8?q?=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - UserProtocolController: +类级 menuCode=system:protocol + 10 方法级 (view/manage), find-default 已有 @IgnoreAuth 跳过 - UserProtocolVersionController: +类级 menuCode=system:protocol + 7 方法级 (view/manage/publish) - PermCodeController: get-by-menu 补 view; find-codes-by-user 已有 @IgnoreAuth 跳过 --- .../permission/resource/PermCodeController.java | 1 + .../controller/protocol/UserProtocolController.java | 12 ++++++++++++ .../protocol/UserProtocolVersionController.java | 9 +++++++++ 3 files changed, 22 insertions(+) diff --git a/daxpay-platform/daxpay-platform-service/service-iam/src/main/java/cn/daxpay/open/platform/iam/controller/permission/resource/PermCodeController.java b/daxpay-platform/daxpay-platform-service/service-iam/src/main/java/cn/daxpay/open/platform/iam/controller/permission/resource/PermCodeController.java index 350f5a8de..8ae2925db 100644 --- a/daxpay-platform/daxpay-platform-service/service-iam/src/main/java/cn/daxpay/open/platform/iam/controller/permission/resource/PermCodeController.java +++ b/daxpay-platform/daxpay-platform-service/service-iam/src/main/java/cn/daxpay/open/platform/iam/controller/permission/resource/PermCodeController.java @@ -47,6 +47,7 @@ public class PermCodeController { return Res.ok(permCodeScanService.scan(new PermCodeScanParam())); } + @PermCode(code = "view", nameCn = "菜单查看", nameEn = "Menu View") @Operation(summary = "根据菜单查询权限码列表") @GetMapping("/get-by-menu") public Result> findByMenu( diff --git a/daxpay-platform/daxpay-platform-service/service-system/src/main/java/cn/daxpay/open/platform/system/controller/protocol/UserProtocolController.java b/daxpay-platform/daxpay-platform-service/service-system/src/main/java/cn/daxpay/open/platform/system/controller/protocol/UserProtocolController.java index d485963f8..e6cf6dade 100644 --- a/daxpay-platform/daxpay-platform-service/service-system/src/main/java/cn/daxpay/open/platform/system/controller/protocol/UserProtocolController.java +++ b/daxpay-platform/daxpay-platform-service/service-system/src/main/java/cn/daxpay/open/platform/system/controller/protocol/UserProtocolController.java @@ -8,6 +8,7 @@ import cn.daxpay.open.platform.system.result.protocol.UserProtocolContentResult; import cn.daxpay.open.platform.system.result.protocol.UserProtocolResult; import cn.daxpay.open.platform.system.service.protocol.UserProtocolService; import cn.daxpay.open.platform.core.annotation.IgnoreAuth; +import cn.daxpay.open.platform.core.annotation.PermCode; import cn.daxpay.open.platform.common.i18n.util.I18nUtil; import cn.daxpay.open.platform.core.rest.dto.LabelValue; import cn.daxpay.open.platform.core.rest.Res; @@ -27,6 +28,7 @@ import java.util.List; /// # 用户协议控制器 /// +@PermCode(menuCode = "system:protocol") @Validated @Tag(name = "用户协议") @RestController @@ -40,6 +42,7 @@ public class UserProtocolController { /// @param pageParam 分页参数 /// @param query 查询条件 /// @return 用户协议分页结果 + @PermCode(code = "view", nameCn = "协议查看", nameEn = "Protocol View") @Operation(summary = "分页") @GetMapping("/page") public Result> page(PageParam pageParam, UserProtocolQuery query){ @@ -50,6 +53,7 @@ public class UserProtocolController { /// /// @param param 用户协议参数 /// @return 操作结果 + @PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage") @Operation(summary = "新增") @PostMapping("/add") public Result add(@RequestBody @Validated(ValidationGroup.add.class) UserProtocolParam param){ @@ -61,6 +65,7 @@ public class UserProtocolController { /// /// @param param 用户协议参数 /// @return 操作结果 + @PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage") @Operation(summary = "修改") @PostMapping("/update") public Result update(@RequestBody @Validated(ValidationGroup.edit.class) UserProtocolParam param){ @@ -72,6 +77,7 @@ public class UserProtocolController { /// /// @param id 协议ID /// @return 操作结果 + @PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage") @Operation(summary = "删除") @PostMapping("/delete") public Result delete(@NotNull(message = "{validation.field.id.notNull}") Long id){ @@ -83,6 +89,7 @@ public class UserProtocolController { /// /// @param id 协议ID /// @return 用户协议信息 + @PermCode(code = "view", nameCn = "协议查看", nameEn = "Protocol View") @Operation(summary = "查询") @GetMapping("/get") public Result findById(@NotNull(message = "{validation.field.id.notNull}") Long id){ @@ -104,6 +111,7 @@ public class UserProtocolController { return Res.ok(userProtocolService.findDefault(type, clientType, language)); } + @PermCode(code = "view", nameCn = "协议查看", nameEn = "Protocol View") @Operation(summary = "协议类型列表") @GetMapping("/type-options") public Result> typeOptions(){ @@ -112,6 +120,7 @@ public class UserProtocolController { .toList()); } + @PermCode(code = "view", nameCn = "协议查看", nameEn = "Protocol View") @Operation(summary = "协议端类型列表") @GetMapping("/client-type-options") public Result> clientTypeOptions(){ @@ -124,6 +133,7 @@ public class UserProtocolController { /// /// @param id 协议ID /// @return 操作结果 + @PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage") @Operation(summary = "设置默认") @PostMapping("/set-default") public Result setDefault(@NotNull(message = "{validation.field.id.notNull}") Long id){ @@ -135,6 +145,7 @@ public class UserProtocolController { /// /// @param id 协议ID /// @return 操作结果 + @PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage") @Operation(summary = "取消默认") @PostMapping("/cancel-default") public Result cancelDefault(@NotNull(message = "{validation.field.id.notNull}") Long id){ @@ -147,6 +158,7 @@ public class UserProtocolController { /// @param id 源协议ID /// @param clientType 目标端类型 /// @return 目标协议ID + @PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage") @Operation(summary = "复制到其他端") @PostMapping("/copy-to-client") public Result copyToClient(@NotNull(message = "{validation.field.id.notNull}") Long id, diff --git a/daxpay-platform/daxpay-platform-service/service-system/src/main/java/cn/daxpay/open/platform/system/controller/protocol/UserProtocolVersionController.java b/daxpay-platform/daxpay-platform-service/service-system/src/main/java/cn/daxpay/open/platform/system/controller/protocol/UserProtocolVersionController.java index 60e09c677..c27e7ef9d 100644 --- a/daxpay-platform/daxpay-platform-service/service-system/src/main/java/cn/daxpay/open/platform/system/controller/protocol/UserProtocolVersionController.java +++ b/daxpay-platform/daxpay-platform-service/service-system/src/main/java/cn/daxpay/open/platform/system/controller/protocol/UserProtocolVersionController.java @@ -1,5 +1,6 @@ package cn.daxpay.open.platform.system.controller.protocol; +import cn.daxpay.open.platform.core.annotation.PermCode; import cn.daxpay.open.platform.core.rest.Res; import cn.daxpay.open.platform.core.rest.param.PageParam; import cn.daxpay.open.platform.core.rest.result.PageResult; @@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.*; /// # 用户协议版本控制器 /// +@PermCode(menuCode = "system:protocol") @Validated @Tag(name = "用户协议版本") @RestController @@ -31,6 +33,7 @@ public class UserProtocolVersionController { /// @param pageParam 分页参数 /// @param query 查询条件 /// @return 版本分页结果 + @PermCode(code = "view", nameCn = "协议查看", nameEn = "Protocol View") @Operation(summary = "分页") @GetMapping("/page") public Result> page(PageParam pageParam, UserProtocolVersionQuery query){ @@ -40,6 +43,7 @@ public class UserProtocolVersionController { /// 新建草稿 /// /// @param param 版本参数 + @PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage") @Operation(summary = "新建草稿") @PostMapping("/add") public Result add(@RequestBody @Validated(ValidationGroup.add.class) UserProtocolVersionParam param){ @@ -50,6 +54,7 @@ public class UserProtocolVersionController { /// 编辑草稿内容(仅草稿可编辑) /// /// @param param 版本参数 + @PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage") @Operation(summary = "编辑草稿") @PostMapping("/update") public Result update(@RequestBody @Validated(ValidationGroup.edit.class) UserProtocolVersionParam param){ @@ -60,6 +65,7 @@ public class UserProtocolVersionController { /// 删除草稿(仅草稿可删除) /// /// @param id 版本ID + @PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage") @Operation(summary = "删除草稿") @PostMapping("/delete") public Result delete(@NotNull(message = "{validation.field.id.notNull}") Long id){ @@ -71,6 +77,7 @@ public class UserProtocolVersionController { /// /// @param id 版本ID /// @return 版本信息 + @PermCode(code = "view", nameCn = "协议查看", nameEn = "Protocol View") @Operation(summary = "查询") @GetMapping("/get") public Result findById(@NotNull(message = "{validation.field.id.notNull}") Long id){ @@ -80,6 +87,7 @@ public class UserProtocolVersionController { /// 发布版本(草稿 -> 已发布, 同协议同语言原已发布自动归档) /// /// @param id 版本ID + @PermCode(code = "publish", nameCn = "协议发布", nameEn = "Protocol Publish") @Operation(summary = "发布版本") @PostMapping("/publish") public Result publish(@NotNull(message = "{validation.field.id.notNull}") Long id){ @@ -90,6 +98,7 @@ public class UserProtocolVersionController { /// 归档版本(已发布 -> 归档) /// /// @param id 版本ID + @PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage") @Operation(summary = "归档版本") @PostMapping("/archive") public Result archive(@NotNull(message = "{validation.field.id.notNull}") Long id){