Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b62c7f2495 | ||
|
|
bc901e2f0b | ||
|
|
74dd150469 | ||
|
|
2b7c94e7c3 | ||
|
|
03a4d4a8ff | ||
|
|
7d8172e063 | ||
|
|
e5a065fbaf | ||
|
|
470b586085 | ||
|
|
a8c04cf342 | ||
|
|
669118c0f8 | ||
|
|
3d0f9b9d1b | ||
|
|
b2cbe15d8b | ||
|
|
a5426ce894 | ||
|
|
634de93ffe | ||
|
|
aef3864a31 | ||
|
|
9a6bdfc3f0 | ||
|
|
996830bec7 | ||
|
|
d029ba58c3 | ||
|
|
b0b623fa10 | ||
|
|
cd88f94277 | ||
|
|
4f1a5cbd9d | ||
|
|
9aac55a180 | ||
|
|
6fd765661d | ||
|
|
47970cd8ff | ||
|
|
7222d19d02 | ||
|
|
5d55aee586 | ||
|
|
14a81d1080 | ||
|
|
ada3fbf9cb | ||
|
|
3d53a6a34b | ||
|
|
fe8e9b7a8c | ||
|
|
f6c99bd262 | ||
|
|
389bee2e45 | ||
|
|
f3eddc69af | ||
|
|
c20f0b6f45 | ||
|
|
282832b950 | ||
|
|
1241f19c16 | ||
|
|
72111f0a1b | ||
|
|
4ba6e3a76f | ||
|
|
98b48cc9ae | ||
|
|
b3db103494 | ||
|
|
618d91c6aa | ||
|
|
d7a7a88232 | ||
|
|
7d272d3cd3 | ||
|
|
adaadcbe51 | ||
|
|
a4abdc0632 | ||
|
|
dbf7cb8b0f | ||
|
|
ce2a0d2995 | ||
|
|
f0b001dba9 | ||
|
|
7743b1bab2 | ||
|
|
0dab1ad039 | ||
|
|
12fb82de34 | ||
|
|
8fe00fbb7c | ||
|
|
982b1ee3e4 | ||
|
|
b6f20c976d | ||
|
|
369da9f997 | ||
|
|
cd8e552d21 | ||
|
|
05e28c2c6d | ||
|
|
b30434777d | ||
|
|
4aafb17214 | ||
|
|
c18d0e8a9f | ||
|
|
134218b56a | ||
|
|
5a07bfb7e3 | ||
|
|
1203ccfa4a | ||
|
|
7adea85e1f | ||
|
|
1b221b13d1 | ||
|
|
48eaf2356f | ||
|
|
970952d9fa | ||
|
|
135996ce19 | ||
|
|
e5bfb59a1c | ||
|
|
51c1d20d3c | ||
|
|
6b85cddede | ||
|
|
9256e08cfc | ||
|
|
d0dcd0283e | ||
|
|
76c5495c32 | ||
|
|
e486f850f2 | ||
|
|
cee7dd2442 | ||
|
|
8f2545f271 | ||
|
|
76c2f3a5fd | ||
|
|
b5a7c0d46c | ||
|
|
088afbe5c1 | ||
|
|
0d155ec5b2 | ||
|
|
7d53d31c3f | ||
|
|
cd8bcae5be | ||
|
|
a2b6253d1d | ||
|
|
bb542e7510 | ||
|
|
6ac84c11b2 | ||
|
|
1192bee431 | ||
|
|
c77813af0d | ||
|
|
eba4461381 | ||
|
|
aa7b83ed1e | ||
|
|
ac310414fe | ||
|
|
f5ad238015 | ||
|
|
8618a00e5d | ||
|
|
5f97a1933e | ||
|
|
4bdb24e9ac | ||
|
|
398e1b8095 | ||
|
|
086d2b42e2 | ||
|
|
425922fd04 | ||
|
|
b24d6b3a01 | ||
|
|
c35132d06b | ||
|
|
91072d6d50 | ||
|
|
d65424e5bf | ||
|
|
f0b72b70e7 | ||
|
|
daa5a6aa5e | ||
|
|
2a35793baf | ||
|
|
4a157e9578 | ||
|
|
eabb4c6aa6 | ||
|
|
d22df698b6 | ||
|
|
cb6051cc41 | ||
|
|
1d1009b121 | ||
|
|
94f3fbb867 | ||
|
|
1771bf9909 | ||
|
|
fc4d55517b | ||
|
|
ec72a99d74 | ||
|
|
a431db6e6e | ||
|
|
9cfb31b015 | ||
|
|
15d69f9361 | ||
|
|
b000390a75 | ||
|
|
1b9f92caf5 | ||
|
|
7b08641acc | ||
|
|
66c13062b2 | ||
|
|
2b4089ef59 | ||
|
|
cdf8a426e9 | ||
|
|
a2d69fe721 | ||
|
|
19db357b44 | ||
|
|
07ffef3e2a | ||
|
|
20c3e1f422 | ||
|
|
f93ec3cd4d | ||
|
|
3cdac98832 | ||
|
|
c122c35376 | ||
|
|
3b19d9e930 | ||
|
|
2ea06fb5c0 | ||
|
|
00bb300755 | ||
|
|
ea44dd5c0e | ||
|
|
818207d6c9 | ||
|
|
af76eb43b8 | ||
|
|
5fd11e9caf | ||
|
|
d920b8630d | ||
|
|
0b98dcdfe9 | ||
|
|
1e62576d36 | ||
|
|
b373cbbe46 | ||
|
|
bb5abcb48e | ||
|
|
acd97c7b9b | ||
|
|
4a549e77cb | ||
|
|
118bdb1666 | ||
|
|
461af4d581 | ||
|
|
37dc1c9904 | ||
|
|
3a4386261c | ||
|
|
01d33a1122 | ||
|
|
db2fca5715 | ||
|
|
f3166f0413 | ||
|
|
41f692aad9 | ||
|
|
df16ac3c8e | ||
|
|
913dc3d278 | ||
|
|
731c777b8b | ||
|
|
944de228f7 | ||
|
|
a81c8476e7 | ||
|
|
25c9cd4dfc | ||
|
|
e7cf1a72e3 | ||
|
|
882cd226ec | ||
|
|
eec665109e | ||
|
|
f6a2f5a6f5 | ||
|
|
9ba610de86 | ||
|
|
e59dc363f4 | ||
|
|
eeb7b5b32e | ||
|
|
b4b6a13f8d | ||
|
|
4a7de1909c | ||
|
|
b7fcecfa7b | ||
|
|
3b68e6dd85 | ||
|
|
feb4d7af66 | ||
|
|
5cfcd24657 | ||
|
|
712118556b | ||
|
|
d75ab1ed5f | ||
|
|
4496619eeb | ||
|
|
c85b400a94 | ||
|
|
94c99e3444 | ||
|
|
44c2095d77 | ||
|
|
a501eb7443 | ||
|
|
35ec38ed9c | ||
|
|
2b5be16ad7 | ||
|
|
d747a0fdae | ||
|
|
9f884e2b74 | ||
|
|
0239697a2b | ||
|
|
2b11bdf65e | ||
|
|
19941d9480 | ||
|
|
81933d4e61 | ||
|
|
43d76040d8 | ||
|
|
cd3d522d4f | ||
|
|
8de739cbb7 | ||
|
|
181c5078e9 | ||
|
|
e2e0023d13 | ||
|
|
8c6eed2379 | ||
|
|
c32ecd1f8c | ||
|
|
3c56e21efa | ||
|
|
376f0ecd05 | ||
|
|
e97f46e6b4 | ||
|
|
a208947a1b | ||
|
|
c0f89deb83 | ||
|
|
fc62663f2c | ||
|
|
fcae2eac09 | ||
|
|
2e9225852d | ||
|
|
3a3809b661 | ||
|
|
1b8936f197 | ||
|
|
ce695463d3 | ||
|
|
aff056712e | ||
|
|
af18b0999d | ||
|
|
83c683d473 | ||
|
|
4963988ec2 | ||
|
|
9555474b0b | ||
|
|
022185079c | ||
|
|
acc3f05f12 | ||
|
|
a150f9e017 | ||
|
|
a523df6a07 | ||
|
|
31c583eeb5 | ||
|
|
e3ef3e5275 | ||
|
|
84190b9773 | ||
|
|
7808d22775 | ||
|
|
fba559cd22 | ||
|
|
ecd2fa1c33 | ||
|
|
dcc75efa87 | ||
|
|
a9465299a9 | ||
|
|
42152c7b79 | ||
|
|
1a896ef457 | ||
|
|
9d8990a028 | ||
|
|
17d88fc338 | ||
|
|
bb40f347a3 | ||
|
|
e3236d262d | ||
|
|
3d4e32e5da |
@@ -4,6 +4,7 @@
|
||||
/target
|
||||
/temp
|
||||
/AGENTS.md
|
||||
/.workbuddy
|
||||
|
||||
multilingualField/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
Generated
-9
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources/db/migration/timiserver/V1__init_schema.sql" dialect="MariaDB" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources/db/migration/timiserver/V2__init_system_data.sql" dialect="GenericSQL" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources/mapper/timi-server/gao/GaoEventRecordMapper.xml" dialect="MariaDB" />
|
||||
<file url="PROJECT" dialect="MariaDB" />
|
||||
</component>
|
||||
</project>
|
||||
+115
-74
@@ -1,34 +1,6 @@
|
||||
# the name by which the project can be referenced within Serena
|
||||
# the name by which the project can be referenced within Serena/when chatting with the LLM.
|
||||
project_name: "TimiServerAPI"
|
||||
|
||||
|
||||
# list of languages for which language servers are started; choose from:
|
||||
# al bash clojure cpp csharp
|
||||
# csharp_omnisharp dart elixir elm erlang
|
||||
# fortran fsharp go groovy haskell
|
||||
# haxe java julia kotlin lua
|
||||
# markdown
|
||||
# matlab nix pascal perl php
|
||||
# php_phpactor powershell python python_jedi r
|
||||
# rego ruby ruby_solargraph rust scala
|
||||
# swift terraform toml typescript typescript_vts
|
||||
# vue yaml zig
|
||||
# (This list may be outdated. For the current list, see values of Language enum here:
|
||||
# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py
|
||||
# For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
|
||||
# Note:
|
||||
# - For C, use cpp
|
||||
# - For JavaScript, use typescript
|
||||
# - For Free Pascal/Lazarus, use pascal
|
||||
# Special requirements:
|
||||
# Some languages require additional setup/installations.
|
||||
# See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
|
||||
# When using multiple languages, the first language server that supports a given file will be used for that file.
|
||||
# The first language is the default language and the respective language server will be used as a fallback.
|
||||
# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
|
||||
languages:
|
||||
- java
|
||||
|
||||
# the encoding used by text files in the project
|
||||
# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
|
||||
encoding: "utf-8"
|
||||
@@ -50,12 +22,19 @@ ignore_all_files_in_gitignore: true
|
||||
|
||||
# advanced configuration option allowing to configure language server-specific options.
|
||||
# Maps the language key to the options.
|
||||
# Have a look at the docstring of the constructors of the LS implementations within solidlsp (e.g., for C# or PHP) to see which options are available.
|
||||
# No documentation on options means no options are available.
|
||||
# The settings are considered only if the project is trusted (see global configuration to define trusted projects).
|
||||
# See https://oraios.github.io/serena/02-usage/050_configuration.html#language-server-specific-settings
|
||||
ls_specific_settings: {}
|
||||
|
||||
# list of additional paths to ignore in this project.
|
||||
# Same syntax as gitignore, so you can use * and **.
|
||||
# Important: quote patterns that start with `*`, otherwise YAML treats them as aliases.
|
||||
# Example:
|
||||
# ignored_paths:
|
||||
# - "examples/**"
|
||||
# - ".worktrees/**"
|
||||
# - "**/bin/**"
|
||||
# - "**/obj/**"
|
||||
# Note: global ignored_paths from serena_config.yml are also applied additively.
|
||||
ignored_paths: []
|
||||
|
||||
@@ -66,54 +45,17 @@ read_only: false
|
||||
|
||||
# list of tool names to exclude.
|
||||
# This extends the existing exclusions (e.g. from the global configuration)
|
||||
#
|
||||
# Below is the complete list of tools for convenience.
|
||||
# To make sure you have the latest list of tools, and to view their descriptions,
|
||||
# execute `uv run scripts/print_tool_overview.py`.
|
||||
#
|
||||
# * `activate_project`: Activates a project based on the project name or path.
|
||||
# * `check_onboarding_performed`: Checks whether project onboarding was already performed.
|
||||
# * `create_text_file`: Creates/overwrites a file in the project directory.
|
||||
# * `delete_memory`: Delete a memory file. Should only happen if a user asks for it explicitly,
|
||||
# for example by saying that the information retrieved from a memory file is no longer correct
|
||||
# or no longer relevant for the project.
|
||||
# * `edit_memory`: Replaces content matching a regular expression in a memory.
|
||||
# * `execute_shell_command`: Executes a shell command.
|
||||
# * `find_file`: Finds files in the given relative paths
|
||||
# * `find_referencing_symbols`: Finds symbols that reference the given symbol using the language server backend
|
||||
# * `find_symbol`: Performs a global (or local) search using the language server backend.
|
||||
# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
|
||||
# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
|
||||
# * `initial_instructions`: Provides instructions Serena usage (i.e. the 'Serena Instructions Manual')
|
||||
# for clients that do not read the initial instructions when the MCP server is connected.
|
||||
# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
|
||||
# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
|
||||
# * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
|
||||
# * `list_memories`: List available memories. Any memory can be read using the `read_memory` tool.
|
||||
# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
|
||||
# * `read_file`: Reads a file within the project directory.
|
||||
# * `read_memory`: Read the content of a memory file. This tool should only be used if the information
|
||||
# is relevant to the current task. You can infer whether the information
|
||||
# is relevant from the memory file name.
|
||||
# You should not read the same memory file multiple times in the same conversation.
|
||||
# * `rename_memory`: Renames or moves a memory. Moving between project and global scope is supported
|
||||
# (e.g., renaming "global/foo" to "bar" moves it from global to project scope).
|
||||
# * `rename_symbol`: Renames a symbol throughout the codebase using language server refactoring capabilities.
|
||||
# For JB, we use a separate tool.
|
||||
# * `replace_content`: Replaces content in a file (optionally using regular expressions).
|
||||
# * `replace_symbol_body`: Replaces the full definition of a symbol using the language server backend.
|
||||
# * `safe_delete_symbol`:
|
||||
# * `search_for_pattern`: Performs a search for a pattern in the project.
|
||||
# * `write_memory`: Write some information (utf-8-encoded) about this project that can be useful for future tasks to a memory in md format.
|
||||
# The memory name should be meaningful.
|
||||
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
|
||||
excluded_tools: []
|
||||
|
||||
# list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default).
|
||||
# This extends the existing inclusions (e.g. from the global configuration).
|
||||
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
|
||||
included_optional_tools: []
|
||||
|
||||
# fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
|
||||
# This cannot be combined with non-empty excluded_tools or included_optional_tools.
|
||||
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
|
||||
fixed_tools: []
|
||||
|
||||
# list of mode names to that are always to be included in the set of active modes
|
||||
@@ -124,11 +66,14 @@ fixed_tools: []
|
||||
# Set this to a list of mode names to always include the respective modes for this project.
|
||||
base_modes:
|
||||
|
||||
# list of mode names that are to be activated by default.
|
||||
# The full set of modes to be activated is base_modes + default_modes.
|
||||
# If the setting is undefined, the default_modes from the global configuration (serena_config.yml) apply.
|
||||
# list of mode names that are to be activated by default, overriding the setting in the global configuration.
|
||||
# The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
|
||||
# If the setting is undefined/empty, the default_modes from the global configuration (serena_config.yml) apply.
|
||||
# Otherwise, this overrides the setting from the global configuration (serena_config.yml).
|
||||
# Therefore, you can set this to [] if you do not want the default modes defined in the global config to apply
|
||||
# for this project.
|
||||
# This setting can, in turn, be overridden by CLI parameters (--mode).
|
||||
# See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
|
||||
default_modes:
|
||||
|
||||
# initial prompt for the project. It will always be given to the LLM upon activating the project
|
||||
@@ -152,3 +97,99 @@ read_only_memory_patterns: []
|
||||
# Extends the list from the global configuration, merging the two lists.
|
||||
# Example: ["_archive/.*", "_episodes/.*"]
|
||||
ignored_memory_patterns: []
|
||||
|
||||
# list of language servers to start when using the LSP backend; choose from:
|
||||
# ada al angular ansible astro
|
||||
# bash bsl clojure cpp cpp_ccls
|
||||
# crystal csharp csharp_omnisharp cue dart
|
||||
# deno elixir elm erlang fortran
|
||||
# fsharp gdscript gleam go groovy
|
||||
# haskell haxe hlsl html java
|
||||
# json julia julia_fatou kotlin latex
|
||||
# lean4 lua lua_emmylua luau markdown
|
||||
# matlab msl nextflow nix ocaml
|
||||
# pascal perl php php_devsense php_phpactor
|
||||
# php_phpantom powershell python python_basedpyright python_jedi
|
||||
# python_pyrefly python_ty qml r rego
|
||||
# ruby ruby_solargraph rust scala scss
|
||||
# solidity svelte swift systemverilog terraform
|
||||
# toml typescript typescript_tsgo typescript_vts vue
|
||||
# vbnet wolfram yaml zig
|
||||
# (This list may be outdated; generated with scripts/print_language_list.py;
|
||||
# For the current list, see values of the LanguageServerId enum here:
|
||||
# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py)
|
||||
# For some languages, there are several alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
|
||||
# Note:
|
||||
# - For C, use cpp
|
||||
# - For JavaScript, use typescript
|
||||
# - For Angular projects, use angular (subsumes typescript+html; requires `npm install` in the project root)
|
||||
# - For Astro projects, use astro (subsumes typescript/javascript for .astro projects; requires npm)
|
||||
# - For Svelte projects, use svelte (subsumes typescript/javascript for .svelte projects; requires npm)
|
||||
# - For Deno projects, use deno (serves the same .ts/.js files as typescript; requires the deno CLI on PATH)
|
||||
# - For SCSS / Sass / plain CSS, use scss (some-sass-language-server handles all three)
|
||||
# - For Free Pascal/Lazarus, use pascal
|
||||
# - External Python adapters may add further registered IDs; install the adapter package first
|
||||
# and then use its ID here, for example: example
|
||||
# Special requirements:
|
||||
# Some language servers require additional setup/installations.
|
||||
# See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
|
||||
# When using multiple language servers, the first language server that supports a given file will be used for that file.
|
||||
# The first language server is the default language and the respective language server will be used as a fallback.
|
||||
# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
|
||||
language_servers:
|
||||
- java
|
||||
|
||||
# list of mode names to be activated additionally for this project, e.g. ["query-projects"]
|
||||
# The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
|
||||
# See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
|
||||
added_modes:
|
||||
|
||||
# list of workspace folder paths (LSP backend only).
|
||||
# These folders will be used to build up Serena's symbol index.
|
||||
# Paths must be within the project root and should thus be relative to the project root.
|
||||
# Furthermore, the paths should not be filtered by ignore settings.
|
||||
# Default setting: The entire project root folder (".") is considered.
|
||||
# In (large) monorepos, this can be used to index only subfolders of the project root, e.g.
|
||||
# ls_workspace_folders:
|
||||
# - "./subproject1"
|
||||
# - "./subproject2"
|
||||
ls_workspace_folders:
|
||||
- .
|
||||
|
||||
# list of additional workspace folder paths for cross-package reference support.
|
||||
# Paths can be absolute or relative to the project root.
|
||||
# Each folder is registered as an LSP workspace folder, enabling language servers to discover
|
||||
# symbols and references across package boundaries, but these folders are not indexed by Serena,
|
||||
# i.e. the respective symbols will not be found using Serena's symbol search tools.
|
||||
# Example:
|
||||
# additional_workspace_folders:
|
||||
# - ../sibling-package
|
||||
# - ../shared-lib
|
||||
ls_additional_workspace_folders: []
|
||||
|
||||
# optional shell command to run before the language backend (LSP or JetBrains) is initialised.
|
||||
# the command runs in the project root directory and is only executed if the project is trusted
|
||||
# (see trusted_project_path_patterns in the global configuration).
|
||||
# serena waits for the command to exit: a non-zero exit code is logged as an error but does not
|
||||
# abort activation. a per-project timeout (activation_command_timeout, default 180s) is the safety
|
||||
# backstop for non-terminating commands; on expiry the process is killed and activation continues.
|
||||
# example: activation_command: "npx nx run-many -t build"
|
||||
activation_command:
|
||||
|
||||
# maximum time in seconds to wait for activation_command to complete before killing it (default 180s).
|
||||
# must be a positive number.
|
||||
activation_command_timeout: 180.0
|
||||
|
||||
# list of APIs (facades or facade methods, e.g. "lsp" or "lsp.get_diagnostics_for_symbol") to include in the REPL
|
||||
# that would otherwise be disabled (particularly optional methods, which are disabled by default).
|
||||
# This extends the existing inclusions (e.g. from the global configuration).
|
||||
included_apis: []
|
||||
|
||||
# list of APIs (facades or facade methods, e.g. "lsp" or "lsp.find_symbol") to exclude from the REPL.
|
||||
# This extends the existing exclusions (e.g. from the global configuration).
|
||||
excluded_apis: []
|
||||
|
||||
# The interface through which the agent (LLM) accesses Serena's functionality (overrides the global setting).
|
||||
# Valid values: tools, REPL (see the global configuration for details); leave empty to use the global setting.
|
||||
# Note: the interface is fixed at startup. If a project is activated post-init, its setting is not applied.
|
||||
agent_interface:
|
||||
|
||||
-163
@@ -1,163 +0,0 @@
|
||||
# HTTP 调试与文档规范
|
||||
|
||||
本目录下的 `.http` 文件同时承担接口调试和接口文档职责,也要保证 AIAgent 能稳定读取
|
||||
|
||||
## 目录分工
|
||||
|
||||
### `.http`
|
||||
|
||||
`.http` 只描述接口级信息:
|
||||
|
||||
1. 接口中文名
|
||||
2. 权限要求
|
||||
3. 前置条件
|
||||
4. 请求参数对应的对象说明
|
||||
5. 返回参数对应的对象说明
|
||||
|
||||
`.http` 不重复展开对象字段明细,复杂字段、嵌套结构、枚举值统一写到 `./object` 下
|
||||
|
||||
### `./object`
|
||||
|
||||
`./object` 只描述对象级信息:
|
||||
|
||||
1. 字段名
|
||||
2. 字段类型
|
||||
3. 字段说明
|
||||
4. 枚举值及含义
|
||||
|
||||
所有模块都可能复用的通用对象必须写在 `./object/common.md`
|
||||
|
||||
按业务领域拆分对象说明文件,例如:
|
||||
|
||||
1. `./object/common.md`
|
||||
2. `./object/user.md`
|
||||
3. `./object/role.md`
|
||||
4. `./object/permission.md`
|
||||
|
||||
不要把同一个对象的字段说明散落到多个文件里
|
||||
|
||||
## 全局约定
|
||||
|
||||
### 返回包装
|
||||
|
||||
除使用 `IgnoreGlobalReturn` 跳过全局包装的方法外,接口默认都会经过
|
||||
[GlobalReturnHandler](E:/IDEAProject/timi-spring/src/main/java/com/imyeyu/spring/util/GlobalReturnHandler.java)
|
||||
统一包装返回
|
||||
|
||||
因此 `.http` 里的 `返回参数` 默认只描述业务 `data` 对象,不再重复赘述全局包装结构
|
||||
|
||||
全局返回包装、通用成功码、错误信息、常见分页壳子等内容统一维护在 `./object/common.md`
|
||||
|
||||
如果接口使用
|
||||
[IgnoreGlobalReturn](E:/IDEAProject/timi-spring/src/main/java/com/imyeyu/spring/annotation/IgnoreGlobalReturn.java)
|
||||
跳过全局包装,必须在对应接口的 `前置条件` 或补充说明里明确写出“该接口不走全局返回包装”
|
||||
|
||||
### 文档真实性
|
||||
|
||||
1. 文档只记录服务端真实行为
|
||||
2. 不写猜测
|
||||
3. 不写“看代码”
|
||||
4. 接口改了就同步更新 `.http` 和 `./object`
|
||||
|
||||
### 变量复用
|
||||
|
||||
能复用的变量统一放在文件顶部,例如 `@user_token`、`@userId`
|
||||
|
||||
## `.http` 模板
|
||||
|
||||
每个接口块固定使用下面格式,不要擅自增删字段名:
|
||||
|
||||
```http
|
||||
### <接口中文名>
|
||||
### 权限:
|
||||
### 前置条件:
|
||||
### 请求参数:
|
||||
### 返回参数:
|
||||
|
||||
POST {{baseUrl}}/path
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{}
|
||||
```
|
||||
|
||||
## `.http` 填写要求
|
||||
|
||||
### 接口中文名
|
||||
|
||||
直接写接口用途,别写成控制器方法名
|
||||
|
||||
### 权限
|
||||
|
||||
1. 优先直接翻译控制器上的真实注解
|
||||
2. 同时存在角色和权限时一起写,例如 `需要 ADMIN 角色 + USER_UPDATE 权限`
|
||||
3. 只有 Token 要求时写 `需要有效 Token`
|
||||
4. 无需登录时直接写 `无需登录`
|
||||
|
||||
### 前置条件
|
||||
|
||||
这里只写接口调用前必须知道的约束,例如:
|
||||
|
||||
1. 需要先登录并回填 `user_token`
|
||||
2. 需要先创建用户再传入 `userId`
|
||||
3. 重复调用可能因为唯一约束失败
|
||||
4. 接口当前实现为空
|
||||
5. 该接口不走全局返回包装
|
||||
|
||||
没有额外限制时写 `无`
|
||||
|
||||
### 请求参数
|
||||
|
||||
只写请求对象名和对象说明文件,不在 `.http` 内展开字段
|
||||
|
||||
推荐格式:
|
||||
|
||||
1. `无`
|
||||
2. `UserCreateRequest,详见 ./object/user.md`
|
||||
3. `Page<UserQuery>,详见 ./object/common.md 和 ./object/user.md`
|
||||
|
||||
### 返回参数
|
||||
|
||||
只写业务返回对象名和对象说明文件,不在 `.http` 内展开字段
|
||||
|
||||
推荐格式:
|
||||
|
||||
1. `无`
|
||||
2. `User,详见 ./object/user.md`
|
||||
3. `PageResult<User>,详见 ./object/common.md 和 ./object/user.md`
|
||||
4. `二进制数据流,该接口不走全局返回包装`
|
||||
|
||||
## `./object` 编写要求
|
||||
|
||||
对象说明统一使用 Markdown 表格,推荐结构如下
|
||||
|
||||
```md
|
||||
## User
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| name | String | 登录名,系统内唯一 |
|
||||
|
||||
## RoleCode
|
||||
|
||||
| 枚举 | 说明 |
|
||||
|---|---|
|
||||
| SYSTEM | 系统 |
|
||||
| ADMIN | 管理员 |
|
||||
```
|
||||
|
||||
### 对象说明规则
|
||||
|
||||
1. 一个对象一个标题,标题名必须和 `.http` 里引用的对象名一致
|
||||
2. 字段说明只写真实存在且调用方需要关心的内容
|
||||
3. 枚举单独列出,不要把枚举值混进普通字段表
|
||||
4. 嵌套对象、列表元素对象也要有独立标题
|
||||
5. 通用壳子对象统一写在 `./object/common.md`
|
||||
|
||||
## 维护要求
|
||||
|
||||
1. 一个控制器通常对应一个 `.http` 文件
|
||||
2. 新增接口时,同步补齐对应 `.http`
|
||||
3. 新增或修改对象字段时,同步更新对应 `./object/*.md`
|
||||
4. 注释语言统一用中文
|
||||
5. 示例请求优先保证可调试,其次才是看起来完整
|
||||
@@ -1,200 +0,0 @@
|
||||
### AttachmentController 接口测试
|
||||
### 在 IDEA 中选择 dev 或 prod 环境后执行
|
||||
|
||||
@attachmentId =
|
||||
@attachmentBizType = TEMP_FILE
|
||||
@attachmentBizId = demo-biz-id
|
||||
@attachmentAttachType = SOURCE
|
||||
@attachmentName = demo.png
|
||||
@attachmentFilePath = E:/Temp/demo.png
|
||||
@attachmentTempFileId =
|
||||
|
||||
### 查询附件详情
|
||||
### 前置条件:`id` 必须传有效附件 ID
|
||||
### 请求参数:URL 参数 `id` 为附件 ID
|
||||
### 返回参数:Attachment,详见 ./object/common.md
|
||||
POST {{baseUrl}}/attach/detail?id={{attachmentId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 创建附件
|
||||
### 前置条件:回填 `attachmentFilePath` 为本地文件绝对路径
|
||||
### 请求参数:multipart/form-data
|
||||
### 返回参数:Attachment,详见 ./object/common.md
|
||||
POST {{baseUrl}}/attach/create
|
||||
Content-Type: multipart/form-data; boundary=AttachmentCreateBoundary
|
||||
Token: {{user_token}}
|
||||
|
||||
--AttachmentCreateBoundary
|
||||
Content-Disposition: form-data; name="bizType"
|
||||
|
||||
{{attachmentBizType}}
|
||||
--AttachmentCreateBoundary
|
||||
Content-Disposition: form-data; name="bizId"
|
||||
|
||||
{{attachmentBizId}}
|
||||
--AttachmentCreateBoundary
|
||||
Content-Disposition: form-data; name="attachType"
|
||||
|
||||
{{attachmentAttachType}}
|
||||
--AttachmentCreateBoundary
|
||||
Content-Disposition: form-data; name="name"
|
||||
|
||||
{{attachmentName}}
|
||||
--AttachmentCreateBoundary
|
||||
Content-Disposition: form-data; name="file"; filename="demo.png"
|
||||
Content-Type: application/octet-stream
|
||||
|
||||
< {{attachmentFilePath}}
|
||||
--AttachmentCreateBoundary--
|
||||
|
||||
### 更新附件元数据
|
||||
### 前置条件:`id` 必须传有效附件 ID
|
||||
### 请求参数:multipart/form-data
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/attach/update
|
||||
Content-Type: multipart/form-data; boundary=AttachmentUpdateMetaBoundary
|
||||
Token: {{user_token}}
|
||||
|
||||
--AttachmentUpdateMetaBoundary
|
||||
Content-Disposition: form-data; name="id"
|
||||
|
||||
{{attachmentId}}
|
||||
--AttachmentUpdateMetaBoundary
|
||||
Content-Disposition: form-data; name="name"
|
||||
|
||||
{{attachmentName}}-updated
|
||||
--AttachmentUpdateMetaBoundary
|
||||
Content-Disposition: form-data; name="attachType"
|
||||
|
||||
{{attachmentAttachType}}
|
||||
--AttachmentUpdateMetaBoundary--
|
||||
|
||||
### 更新附件文件
|
||||
### 前置条件:`id` 必须传有效附件 ID,`attachmentFilePath` 必须传本地文件绝对路径
|
||||
### 请求参数:multipart/form-data
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/attach/update
|
||||
Content-Type: multipart/form-data; boundary=AttachmentUpdateFileBoundary
|
||||
Token: {{user_token}}
|
||||
|
||||
--AttachmentUpdateFileBoundary
|
||||
Content-Disposition: form-data; name="id"
|
||||
|
||||
{{attachmentId}}
|
||||
--AttachmentUpdateFileBoundary
|
||||
Content-Disposition: form-data; name="name"
|
||||
|
||||
{{attachmentName}}-file-updated
|
||||
--AttachmentUpdateFileBoundary
|
||||
Content-Disposition: form-data; name="file"; filename="demo.png"
|
||||
Content-Type: application/octet-stream
|
||||
|
||||
< {{attachmentFilePath}}
|
||||
--AttachmentUpdateFileBoundary--
|
||||
|
||||
### 删除附件
|
||||
### 前置条件:`id` 必须传有效附件 ID
|
||||
### 请求参数:URL 参数 `id` 为附件 ID
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/attach/delete?id={{attachmentId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 按业务查询单个附件
|
||||
### 前置条件:`bizType` 和 `bizId` 必须传有效值
|
||||
### 请求参数:URL 参数 `bizType`、`bizId`
|
||||
### 返回参数:Attachment,详见 ./object/common.md
|
||||
GET {{baseUrl}}/attach/detail/byBiz?bizType={{attachmentBizType}}&bizId={{attachmentBizId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 按业务和附件类型查询单个附件
|
||||
### 前置条件:`bizType`、`bizId`、`attachType` 必须传有效值
|
||||
### 请求参数:URL 参数 `bizType`、`bizId`、`attachType`
|
||||
### 返回参数:Attachment,详见 ./object/common.md
|
||||
GET {{baseUrl}}/attach/detail/byAttachType?bizType={{attachmentBizType}}&bizId={{attachmentBizId}}&attachType={{attachmentAttachType}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 按业务查询附件列表
|
||||
### 前置条件:`bizType` 和 `bizId` 必须传有效值
|
||||
### 请求参数:URL 参数 `bizType`、`bizId`,可重复传 `attachTypeList`
|
||||
### 返回参数:Attachment[]
|
||||
GET {{baseUrl}}/attach/list/byBiz?bizType={{attachmentBizType}}&bizId={{attachmentBizId}}&attachTypeList={{attachmentAttachType}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 按业务统计附件数量
|
||||
### 前置条件:`bizType` 和 `bizId` 必须传有效值
|
||||
### 请求参数:URL 参数 `bizType`、`bizId`,可重复传 `attachTypeList`
|
||||
### 返回参数:number
|
||||
GET {{baseUrl}}/attach/count/byBiz?bizType={{attachmentBizType}}&bizId={{attachmentBizId}}&attachTypeList={{attachmentAttachType}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 按业务分页查询附件
|
||||
### 前置条件:`bizType` 和 `bizId` 必须传有效值
|
||||
### 请求参数:URL 参数 `bizType`、`bizId`,可重复传 `attachTypeList`,请求体为 Page
|
||||
### 返回参数:PageResult<Attachment>
|
||||
POST {{baseUrl}}/attach/page/byBiz?bizType={{attachmentBizType}}&bizId={{attachmentBizId}}&attachTypeList={{attachmentAttachType}}
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"index": 0,
|
||||
"size": 10
|
||||
}
|
||||
|
||||
### 按业务差分更新附件
|
||||
### 前置条件:新增项需要传有效 `tempFileId`
|
||||
### 请求参数:BizUpdateReq
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/attach/update/byBiz
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"bizType": "{{attachmentBizType}}",
|
||||
"bizId": "{{attachmentBizId}}",
|
||||
"items": [
|
||||
{
|
||||
"id": "{{attachmentId}}",
|
||||
"attachType": "{{attachmentAttachType}}",
|
||||
"name": "{{attachmentName}}-biz-updated"
|
||||
},
|
||||
{
|
||||
"tempFileId": "{{attachmentTempFileId}}",
|
||||
"attachType": "{{attachmentAttachType}}",
|
||||
"name": "{{attachmentName}}-from-temp"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
### 按业务删除全部附件
|
||||
### 前置条件:`bizType` 和 `bizId` 必须传有效值
|
||||
### 请求参数:BizDeleteReq
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/attach/delete/byBiz
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"bizType": "{{attachmentBizType}}",
|
||||
"bizId": "{{attachmentBizId}}"
|
||||
}
|
||||
|
||||
### 读取附件原图
|
||||
### 前置条件:`attachmentId` 必须传有效附件 ID
|
||||
### 请求参数:路径参数 `id`
|
||||
### 返回参数:附件二进制流
|
||||
GET {{baseUrl}}/attach/read/{{attachmentId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 读取附件缩略图
|
||||
### 前置条件:`attachmentId` 必须传有效图片或视频附件 ID
|
||||
### 请求参数:路径参数 `id`,URL 参数 `thumbWidth`、`thumbHeight`
|
||||
### 返回参数:附件二进制流
|
||||
GET {{baseUrl}}/attach/read/{{attachmentId}}?thumbWidth=200&thumbHeight=200
|
||||
Token: {{user_token}}
|
||||
|
||||
### 下载附件
|
||||
### 前置条件:`attachmentId` 必须传有效附件 ID
|
||||
### 请求参数:路径参数 `id`
|
||||
### 返回参数:附件二进制流
|
||||
GET {{baseUrl}}/attach/download/{{attachmentId}}
|
||||
Token: {{user_token}}
|
||||
@@ -1,66 +0,0 @@
|
||||
### MultilingualController 接口测试
|
||||
### 在 IDEA 中选择 dev 或 prod 环境后执行
|
||||
|
||||
@multilingualId =
|
||||
@multilingualZhCN = 测试简体中文
|
||||
@multilingualZhTW = 測試繁體中文
|
||||
@multilingualEnUS = Test English
|
||||
@multilingualRuRU = Тест
|
||||
@multilingualJaJP = テスト
|
||||
@multilingualDeDE = Test Deutsch
|
||||
@multilingualKoKR = 테스트
|
||||
|
||||
### 查询多语言详情
|
||||
### 权限:需要 ADMIN 角色 + MULTILINGUAL_READ 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`,URL 参数 `id` 必须传有效多语言 ID
|
||||
### 请求参数:无请求体,URL 参数:`id` 为多语言 ID
|
||||
### 返回参数:Multilingual,详见 ./object/common.md
|
||||
POST {{baseUrl}}/system/multilingual/detail?id={{multilingualId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 创建多语言
|
||||
### 权限:需要 ADMIN 角色 + MULTILINGUAL_CREATE 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`
|
||||
### 请求参数:Multilingual,详见 ./object/common.md
|
||||
### 返回参数:Multilingual,详见 ./object/common.md
|
||||
POST {{baseUrl}}/system/multilingual/create
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"zhCN": "{{multilingualZhCN}}",
|
||||
"zhTW": "{{multilingualZhTW}}",
|
||||
"enUS": "{{multilingualEnUS}}",
|
||||
"ruRU": "{{multilingualRuRU}}",
|
||||
"jaJP": "{{multilingualJaJP}}",
|
||||
"deDE": "{{multilingualDeDE}}",
|
||||
"koKR": "{{multilingualKoKR}}"
|
||||
}
|
||||
|
||||
### 更新多语言
|
||||
### 权限:需要 ADMIN 角色 + MULTILINGUAL_UPDATE 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`,`id` 必须存在
|
||||
### 请求参数:Multilingual,详见 ./object/common.md
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/system/multilingual/update
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"id": "{{multilingualId}}",
|
||||
"zhCN": "{{multilingualZhCN}}-已更新",
|
||||
"zhTW": "{{multilingualZhTW}}-已更新",
|
||||
"enUS": "{{multilingualEnUS}}-updated",
|
||||
"ruRU": "{{multilingualRuRU}}-updated",
|
||||
"jaJP": "{{multilingualJaJP}}-updated",
|
||||
"deDE": "{{multilingualDeDE}}-updated",
|
||||
"koKR": "{{multilingualKoKR}}-updated"
|
||||
}
|
||||
|
||||
### 删除多语言
|
||||
### 权限:需要 ADMIN 角色 + MULTILINGUAL_DELETE 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`,URL 参数 `id` 必须传有效多语言 ID
|
||||
### 请求参数:无请求体,URL 参数:`id` 为多语言 ID
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/system/multilingual/delete?id={{multilingualId}}
|
||||
Token: {{user_token}}
|
||||
@@ -1,60 +0,0 @@
|
||||
### GaoRegisterAction 接口测试
|
||||
### 在 IDEA 中选择 dev 或 prod 环境后执行
|
||||
|
||||
@actionId =
|
||||
|
||||
### 分页查询登记行为
|
||||
POST {{baseUrl}}/gao/action/list
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"index": 0,
|
||||
"size": 16
|
||||
}
|
||||
|
||||
### 查询启用行为
|
||||
POST {{baseUrl}}/gao/action/enabled/list
|
||||
Token: {{user_token}}
|
||||
|
||||
### 查询行为详情
|
||||
POST {{baseUrl}}/gao/action/detail?id={{actionId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 创建登记行为
|
||||
POST {{baseUrl}}/gao/action/create
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"name": "签到",
|
||||
"description": "客户到店签到",
|
||||
"enabled": true,
|
||||
"requirePhoto": false,
|
||||
"sort": 10,
|
||||
"permissionCodeList": [
|
||||
"RECORD:CREATE"
|
||||
]
|
||||
}
|
||||
|
||||
### 更新登记行为
|
||||
POST {{baseUrl}}/gao/action/update
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"id": "{{actionId}}",
|
||||
"name": "物品领取",
|
||||
"description": "登记客户领取物品",
|
||||
"enabled": true,
|
||||
"requirePhoto": true,
|
||||
"sort": 20,
|
||||
"permissionCodeList": [
|
||||
"RECORD:CREATE",
|
||||
"STAT:READ"
|
||||
]
|
||||
}
|
||||
|
||||
### 删除登记行为
|
||||
POST {{baseUrl}}/gao/action/delete?id={{actionId}}
|
||||
Token: {{user_token}}
|
||||
@@ -1,119 +0,0 @@
|
||||
### GaoCustomer 接口测试
|
||||
### 在 IDEA 中选择 dev 或 prod 环境后执行
|
||||
|
||||
@customerId =
|
||||
@introducerCustomerId =
|
||||
@customerCode = GAO-0001
|
||||
|
||||
### 分页查询客户
|
||||
POST {{baseUrl}}/gao/customer/list
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"index": 0,
|
||||
"size": 16
|
||||
}
|
||||
|
||||
### 搜索客户
|
||||
POST {{baseUrl}}/gao/customer/search
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"keyword": "张",
|
||||
"introducerCustomerId": "{{introducerCustomerId}}"
|
||||
}
|
||||
|
||||
### 查询客户详情
|
||||
POST {{baseUrl}}/gao/customer/detail?id={{customerId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 按客户编码查询
|
||||
POST {{baseUrl}}/gao/customer/detail/code?code={{customerCode}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 查询某客户邀请了哪些人
|
||||
POST {{baseUrl}}/gao/customer/invited/list?introducerCustomerId={{customerId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 创建客户
|
||||
POST {{baseUrl}}/gao/customer/create
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"code": "{{customerCode}}",
|
||||
"name": "张三",
|
||||
"age": 56,
|
||||
"telephone": "020-88886666",
|
||||
"address": "广州市天河区某街道",
|
||||
"remark": "首诊客户",
|
||||
"disease": "肩颈不适",
|
||||
"conditioningPart": [
|
||||
{
|
||||
"code": "neck",
|
||||
"name": "颈部"
|
||||
},
|
||||
{
|
||||
"code": "shoulder",
|
||||
"name": "肩部"
|
||||
}
|
||||
],
|
||||
"introducerCustomerId": "{{introducerCustomerId}}"
|
||||
}
|
||||
|
||||
### 更新客户
|
||||
POST {{baseUrl}}/gao/customer/update
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"id": "{{customerId}}",
|
||||
"code": "{{customerCode}}",
|
||||
"name": "张三",
|
||||
"age": 57,
|
||||
"telephone": "020-88886667",
|
||||
"address": "广州市天河区某街道 88 号",
|
||||
"remark": "复诊客户",
|
||||
"disease": "腰背调理",
|
||||
"conditioningPart": {
|
||||
"parts": [
|
||||
"waist",
|
||||
"back"
|
||||
]
|
||||
},
|
||||
"introducerCustomerId": "{{introducerCustomerId}}"
|
||||
}
|
||||
|
||||
### 删除客户
|
||||
POST {{baseUrl}}/gao/customer/delete?id={{customerId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 创建客户邀请关系
|
||||
POST {{baseUrl}}/gao/customer/invite/create
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"customerId": "{{customerId}}",
|
||||
"introducerCustomerId": "{{introducerCustomerId}}"
|
||||
}
|
||||
|
||||
### 查询客户邀请关系详情
|
||||
POST {{baseUrl}}/gao/customer/invite/detail?customerId={{customerId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 更新客户邀请关系
|
||||
POST {{baseUrl}}/gao/customer/invite/update
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"customerId": "{{customerId}}",
|
||||
"introducerCustomerId": "{{introducerCustomerId}}"
|
||||
}
|
||||
|
||||
### 删除客户邀请关系
|
||||
POST {{baseUrl}}/gao/customer/invite/delete?customerId={{customerId}}
|
||||
Token: {{user_token}}
|
||||
@@ -1,86 +0,0 @@
|
||||
### GaoRegisterRecord 接口测试
|
||||
### 在 IDEA 中选择 dev 或 prod 环境后执行
|
||||
|
||||
@recordId =
|
||||
@customerId =
|
||||
@customerCode = GAO-0001
|
||||
@actionId =
|
||||
|
||||
### 分页查询登记记录
|
||||
POST {{baseUrl}}/gao/record/list
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"index": 0,
|
||||
"size": 16
|
||||
}
|
||||
|
||||
### 查询登记记录详情
|
||||
POST {{baseUrl}}/gao/record/detail?id={{recordId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 创建登记记录,直接传客户 ID
|
||||
POST {{baseUrl}}/gao/record/create
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"customerId": "{{customerId}}",
|
||||
"actionId": "{{actionId}}",
|
||||
"remark": "客户到店签到"
|
||||
}
|
||||
|
||||
### 创建登记记录,扫码后传客户编码
|
||||
POST {{baseUrl}}/gao/record/create
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"customerCode": "{{customerCode}}",
|
||||
"actionId": "{{actionId}}",
|
||||
"remark": "扫码快速登记"
|
||||
}
|
||||
|
||||
### 更新登记记录
|
||||
POST {{baseUrl}}/gao/record/update
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"id": "{{recordId}}",
|
||||
"customerId": "{{customerId}}",
|
||||
"actionId": "{{actionId}}",
|
||||
"remark": "补充备注",
|
||||
"registeredAt": 1785110400
|
||||
}
|
||||
|
||||
### 删除登记记录
|
||||
POST {{baseUrl}}/gao/record/delete?id={{recordId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 按日查询某个行为记录
|
||||
POST {{baseUrl}}/gao/record/period/list
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"actionId": "{{actionId}}",
|
||||
"periodType": "DAY",
|
||||
"periodValue": 20260727
|
||||
}
|
||||
|
||||
### 按月统计某个行为记录
|
||||
POST {{baseUrl}}/gao/record/period/stat
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"actionId": "{{actionId}}",
|
||||
"periodType": "MONTH",
|
||||
"periodValue": 202607
|
||||
}
|
||||
|
||||
### 查询客户所有登记统计
|
||||
POST {{baseUrl}}/gao/record/customer/stat?customerId={{customerId}}
|
||||
Token: {{user_token}}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"dev": {
|
||||
"baseUrl": "http://localhost:8091"
|
||||
},
|
||||
"prod": {
|
||||
"baseUrl": "https://api.example.com"
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
# 通用对象说明
|
||||
|
||||
## TimiResponse<T>
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| code | Integer | 响应码,`20000` 为成功 |
|
||||
| msg | String | 响应消息 |
|
||||
| data | T | 业务数据体,具体结构由接口返回对象决定 |
|
||||
|
||||
## Page<T>
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| index | int | 页码下标,从 `0` 开始 |
|
||||
| size | long | 每页数量 |
|
||||
| equalsExample | T | 精确匹配示例对象,非空字段参与精确查询 |
|
||||
| likesExample | T | 模糊匹配示例对象,非空字段参与模糊查询 |
|
||||
| equalsLogic | Logic | 精确匹配字段之间的连接逻辑,默认 `AND` |
|
||||
| likesLogic | Logic | 模糊匹配字段之间的连接逻辑,默认 `OR` |
|
||||
| orderMap | LinkedHashMap<String, OrderType> | 排序字段映射,键通常为字段名,值为排序方向 |
|
||||
|
||||
## PageResult<T>
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| total | long | 总数据量 |
|
||||
| pages | int | 总页数 |
|
||||
| list | List<T> | 当前页数据列表 |
|
||||
|
||||
## UUIDEntity
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| id | String | 主键 ID,UUID 字符串 |
|
||||
| createdAt | Long | 创建时间,Unix 时间戳毫秒 |
|
||||
| updatedAt | Long | 更新时间,Unix 时间戳毫秒 |
|
||||
| deletedAt | Long | 删除时间,Unix 时间戳毫秒,未删除时通常为空 |
|
||||
|
||||
## Multilingual
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| id | String | 多语言 ID |
|
||||
| zhCN | String | 简体中文文本 |
|
||||
| zhTW | String | 繁体中文文本 |
|
||||
| enUS | String | 英文文本 |
|
||||
| ruRU | String | 俄文文本 |
|
||||
| jaJP | String | 日文文本 |
|
||||
| deDE | String | 德文文本 |
|
||||
| koKR | String | 韩文文本 |
|
||||
| lastAccessAt | Long | 最后访问时间,Unix 时间戳毫秒 |
|
||||
| createdAt | Long | 创建时间,Unix 时间戳毫秒 |
|
||||
| updatedAt | Long | 更新时间,Unix 时间戳毫秒 |
|
||||
| deletedAt | Long | 删除时间,Unix 时间戳毫秒,未删除时通常为空 |
|
||||
|
||||
## Logic
|
||||
|
||||
| 枚举 | 说明 |
|
||||
|---|---|
|
||||
| AND | 多个条件同时满足 |
|
||||
| OR | 多个条件满足其一 |
|
||||
|
||||
## OrderType
|
||||
|
||||
| 枚举 | 说明 |
|
||||
|---|---|
|
||||
| ASC | 升序 |
|
||||
| DESC | 降序 |
|
||||
|
||||
## ImageType
|
||||
|
||||
| 枚举 | 说明 |
|
||||
|---|---|
|
||||
| AUTO | 双线性 |
|
||||
| SMOOTH | 模糊 |
|
||||
| PIXELATED | 像素 |
|
||||
@@ -1,31 +0,0 @@
|
||||
# 权限对象说明
|
||||
|
||||
## Permission
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| id | String | 权限 ID |
|
||||
| createdAt | Long | 创建时间,Unix 时间戳毫秒 |
|
||||
| updatedAt | Long | 更新时间,Unix 时间戳毫秒 |
|
||||
| deletedAt | Long | 删除时间,Unix 时间戳毫秒 |
|
||||
| code | String | 权限代码,需与数据库 `permission.code` 保持一致 |
|
||||
| nameLangId | String | 权限名称的多语言键 |
|
||||
| description | String | 权限说明 |
|
||||
| name | String | 当前语言下的权限名称 |
|
||||
|
||||
## BatchCreateReq
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| prefixCode | String | 权限代码前缀,例如 `ROLE` |
|
||||
| prefixName | String | 权限名称前缀,例如 `角色` |
|
||||
| types | Type[] | 需要批量生成的权限类型列表,详见 `BatchCreateType` |
|
||||
|
||||
## BatchCreateType
|
||||
|
||||
| 枚举 | 说明 |
|
||||
|---|---|
|
||||
| CREATE | 创建权限 |
|
||||
| READ | 读取权限 |
|
||||
| UPDATE | 更新权限 |
|
||||
| DELETE | 删除权限 |
|
||||
@@ -1,34 +0,0 @@
|
||||
# 角色对象说明
|
||||
|
||||
## Role
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| id | String | 角色 ID |
|
||||
| createdAt | Long | 创建时间,Unix 时间戳毫秒 |
|
||||
| updatedAt | Long | 更新时间,Unix 时间戳毫秒 |
|
||||
| deletedAt | Long | 删除时间,Unix 时间戳毫秒 |
|
||||
| code | String | 角色代码,常见值见 `RoleCode` |
|
||||
| nameLangId | String | 角色名称的多语言键 |
|
||||
| description | String | 角色说明 |
|
||||
| name | String | 当前语言下的角色名称 |
|
||||
| permissionList | List<Permission> | 角色自身直接绑定的权限列表 |
|
||||
| allPermissionList | List<Permission> | 角色全部权限列表,包含继承自子角色的权限 |
|
||||
| childRoleList | List<Role> | 子角色列表 |
|
||||
| permissionIdList | Set<String> | 权限 ID 列表,创建或更新角色时使用 |
|
||||
| childRoleIdList | Set<String> | 子角色 ID 列表,创建或更新角色时使用 |
|
||||
|
||||
## UserRoleAuthorizeReq
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| userId | String | 目标用户 ID |
|
||||
| roleIdList | List<String> | 需要授权的角色 ID 列表 |
|
||||
| roleCodeList | List<String> | 需要授权的角色代码列表 |
|
||||
|
||||
## RoleCode
|
||||
|
||||
| 枚举 | 说明 |
|
||||
|---|---|
|
||||
| SYSTEM | 系统 |
|
||||
| ADMIN | 管理员 |
|
||||
@@ -1,73 +0,0 @@
|
||||
# 用户对象说明
|
||||
|
||||
## User
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| id | String | 用户 ID |
|
||||
| createdAt | Long | 创建时间,Unix 时间戳毫秒 |
|
||||
| updatedAt | Long | 更新时间,Unix 时间戳毫秒 |
|
||||
| deletedAt | Long | 删除时间,Unix 时间戳毫秒 |
|
||||
| name | String | 登录名,系统内唯一 |
|
||||
| nick | String | 用户昵称 |
|
||||
| password | String | 明文密码,请求时填写,响应通常不返回 |
|
||||
| email | String | 邮箱地址 |
|
||||
| emailVerifyAt | Long | 邮箱验证时间,Unix 时间戳毫秒 |
|
||||
| phoneNo | String | 手机号,11 位大陆手机号 |
|
||||
| phoneNoVerifyAt | Long | 手机号验证时间,Unix 时间戳毫秒 |
|
||||
| wrapperType | ImageType | 背景图渲染算法,详见 `ImageType` |
|
||||
| avatarType | ImageType | 头像渲染算法,详见 `ImageType` |
|
||||
| exp | Integer | 经验值 |
|
||||
| sex | Integer | 性别,当前代码未定义枚举说明 |
|
||||
| birthdate | Long | 出生日期,Unix 时间戳毫秒 |
|
||||
| qq | String | QQ 号 |
|
||||
| description | String | 个人说明 |
|
||||
| lastLoginIP | String | 上次登录 IP |
|
||||
| lastLoginAt | Long | 上次登录时间,Unix 时间戳毫秒 |
|
||||
| unmuteAt | Long | 解除禁言时间,Unix 时间戳毫秒 |
|
||||
| unbanAt | Long | 解除封禁时间,Unix 时间戳毫秒 |
|
||||
| roleList | List<String> | 角色代码列表 |
|
||||
| permissionList | List<String> | 权限代码列表 |
|
||||
| attachmentList | List<Attachment> | 附件列表 |
|
||||
| settingList | List<Setting> | 设置列表 |
|
||||
|
||||
## LoginRequest
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| user | String | 用户标识,可能是 UID、邮箱或用户名 |
|
||||
| password | String | 明文密码 |
|
||||
|
||||
## LoginResponse
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| token | String | 登录令牌 |
|
||||
| expireAt | Long | 令牌过期时间,Unix 时间戳毫秒 |
|
||||
| user | User | 当前登录用户 |
|
||||
|
||||
## UpdatePasswordRequest
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| oldValue | String | 原密码 |
|
||||
| newValue | String | 新密码 |
|
||||
|
||||
## PhoneVerifyCodeSendRequest
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| phoneNo | String | 手机号,必须为 11 位大陆手机号 |
|
||||
|
||||
## PhoneVerifyRequest
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| phoneNo | String | 手机号,必须为 11 位大陆手机号 |
|
||||
| verifyCode | String | 6 位数字验证码 |
|
||||
|
||||
## CancelRequest
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| password | String | 当前密码,用于确认注销 |
|
||||
@@ -1,84 +0,0 @@
|
||||
### PermissionController 接口测试
|
||||
### 在 IDEA 中选择 dev 或 prod 环境后执行
|
||||
|
||||
@user_token =
|
||||
@permissionId =
|
||||
@permissionCode = TEST_PERMISSION
|
||||
@permissionNameLangId = permission.test.name
|
||||
@permissionDescription = 测试权限
|
||||
@moduleCode = CORE
|
||||
|
||||
### 分页查询权限
|
||||
### 权限:需要 PERMISSION_READ 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`
|
||||
### 请求参数:Page<Permission>,详见 ./http/object/permission.md
|
||||
### 返回参数:PageResult<Permission>,详见 ./http/object/permission.md
|
||||
POST {{baseUrl}}/user/permission/list
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"index": 0,
|
||||
"size": 10,
|
||||
"likesExample": {
|
||||
"code": "{{permissionCode}}",
|
||||
"moduleCode": "{{moduleCode}}"
|
||||
}
|
||||
}
|
||||
|
||||
### 创建权限
|
||||
### 权限:当前代码要求 PERMISSION_READ 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`
|
||||
### 请求参数:Permission,详见 ./http/object/permission.md
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/permission/create
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"moduleCode": "{{moduleCode}}",
|
||||
"code": "{{permissionCode}}",
|
||||
"nameLangId": "{{permissionNameLangId}}",
|
||||
"description": "{{permissionDescription}}"
|
||||
}
|
||||
|
||||
### 批量创建权限
|
||||
### 权限:需要 PERMISSION_CREATE 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`
|
||||
### 请求参数:BatchCreateReq,详见 ./http/object/permission.md
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/permission/create/batch
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"moduleCode": "{{moduleCode}}",
|
||||
"prefixCode": "ROLE",
|
||||
"prefixName": "角色",
|
||||
"types": ["CREATE", "READ", "UPDATE", "DELETE"]
|
||||
}
|
||||
|
||||
### 更新权限
|
||||
### 权限:需要 PERMISSION_UPDATE 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`,`id` 必须存在
|
||||
### 请求参数:Permission,详见 ./http/object/permission.md
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/permission/update
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"id": "{{permissionId}}",
|
||||
"moduleCode": "{{moduleCode}}",
|
||||
"code": "{{permissionCode}}",
|
||||
"nameLangId": "{{permissionNameLangId}}",
|
||||
"description": "测试权限-已更新"
|
||||
}
|
||||
|
||||
### 删除权限
|
||||
### 权限:需要 PERMISSION_DELETE 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`,URL 参数 `id` 必须传有效权限 ID
|
||||
### 请求参数:无请求体,URL 参数:`id` 为权限 ID
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/permission/delete?id={{permissionId}}
|
||||
Token: {{user_token}}
|
||||
@@ -1,113 +0,0 @@
|
||||
### RoleController 接口测试
|
||||
### 在 IDEA 中选择 dev 或 prod 环境后执行
|
||||
|
||||
@permissionId =
|
||||
@roleId =
|
||||
@roleCode = TEST_ROLE
|
||||
@roleNameLangId = role.test.name
|
||||
@roleDescription = 测试角色
|
||||
@childRoleId =
|
||||
@authorizedUserId =
|
||||
@moduleCode = CORE
|
||||
|
||||
### 分页查询角色
|
||||
### 权限:需要 ADMIN 角色 + ROLE_READ 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`
|
||||
### 请求参数:Page<Role>,详见 ./http/object/role.md
|
||||
### 返回参数:PageResult<Role>,详见 ./http/object/role.md
|
||||
POST {{baseUrl}}/user/role/list
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"index": 0,
|
||||
"size": 16,
|
||||
"likesExample": {
|
||||
"moduleCode": "{{moduleCode}}"
|
||||
}
|
||||
}
|
||||
|
||||
### 查询角色详情
|
||||
### 权限:需要 ADMIN 角色 + ROLE_READ 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`,URL 参数 `id` 必须传有效角色 ID
|
||||
### 请求参数:无请求体,URL 参数:`id` 为角色 ID
|
||||
### 返回参数:Role,详见 ./http/object/role.md
|
||||
POST {{baseUrl}}/user/role/detail?id={{roleId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 创建角色
|
||||
### 权限:需要 ADMIN 角色 + ROLE_CREATE 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`
|
||||
### 请求参数:Role,详见 ./http/object/role.md
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/role/create
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"moduleCode": "{{moduleCode}}",
|
||||
"code": "{{roleCode}}",
|
||||
"nameLangId": "{{roleNameLangId}}",
|
||||
"description": "{{roleDescription}}",
|
||||
"permissionIdList": ["{{permissionId}}"],
|
||||
"childRoleIdList": []
|
||||
}
|
||||
|
||||
### 更新角色
|
||||
### 权限:需要 ADMIN 角色 + ROLE_UPDATE 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`,`id` 必须存在
|
||||
### 请求参数:Role,详见 ./http/object/role.md
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/role/update
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"id": "{{roleId}}",
|
||||
"moduleCode": "{{moduleCode}}",
|
||||
"code": "{{roleCode}}",
|
||||
"nameLangId": "{{roleNameLangId}}",
|
||||
"description": "测试角色-已更新",
|
||||
"permissionIdList": ["{{permissionId}}"],
|
||||
"childRoleIdList": ["{{childRoleId}}"]
|
||||
}
|
||||
|
||||
### 删除角色
|
||||
### 权限:需要 ADMIN 角色 + ROLE_DELETE 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`,URL 参数 `id` 必须传有效角色 ID
|
||||
### 请求参数:无请求体,URL 参数:`id` 为角色 ID
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/role/delete?id={{roleId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 查询用户角色
|
||||
### 权限:需要 ADMIN 角色 + USER_ROLE_READ 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`,URL 参数 `userId` 必须传有效用户 ID
|
||||
### 请求参数:无请求体,URL 参数:`userId` 为用户 ID
|
||||
### 返回参数:List<Role>,详见 ./http/object/role.md
|
||||
POST {{baseUrl}}/user/role/authorized/list?userId={{authorizedUserId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 设置用户角色
|
||||
### 权限:需要 ADMIN 角色 + 同时具备 USER_ROLE_CREATE 和 USER_ROLE_DELETE 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`
|
||||
### 请求参数:UserRoleAuthorizeReq,详见 ./http/object/role.md
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/role/authorized/create
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"userId": "{{authorizedUserId}}",
|
||||
"moduleCode": "{{moduleCode}}",
|
||||
"roleIdList": ["{{roleId}}"],
|
||||
"roleCodeList": ["{{roleCode}}"]
|
||||
}
|
||||
|
||||
### 查询用户已授权权限
|
||||
### 权限:需要 ADMIN 角色 + USER_ROLE_READ 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`,URL 参数 `userId` 必须传有效用户 ID
|
||||
### 请求参数:无请求体,URL 参数:`userId` 为用户 ID
|
||||
### 返回参数:List<Permission>,详见 ./http/object/permission.md
|
||||
POST {{baseUrl}}/user/role/authorized/permission?userId={{authorizedUserId}}
|
||||
Token: {{user_token}}
|
||||
@@ -1,186 +0,0 @@
|
||||
### UserController 接口测试
|
||||
### 在 IDEA 中选择 dev 或 prod 环境后执行
|
||||
|
||||
@userId =
|
||||
@name = System
|
||||
@password = u#HA027xq$i9]P}uB]LweJspTb!3oS^.
|
||||
@newPassword = qwe123
|
||||
@nick = 测试用户
|
||||
@email = test@example.com
|
||||
|
||||
### 分页查询用户
|
||||
### 权限:需要 ADMIN 角色 + USER_READ 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`
|
||||
### 请求参数:Page<User>,详见 ./http/object/user.md
|
||||
### 返回参数:PageResult<User>,详见 ./http/object/user.md
|
||||
POST {{baseUrl}}/user/list
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"index": 0,
|
||||
"size": 16
|
||||
}
|
||||
|
||||
### 查询用户详情
|
||||
### 权限:需要 ADMIN 角色 + USER_READ 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`,URL 参数 `id` 必须传有效用户 ID
|
||||
### 请求参数:无请求体,URL 参数:`id` 为用户 ID
|
||||
### 返回参数:User,详见 ./http/object/user.md
|
||||
POST {{baseUrl}}/user/detail?id={{userId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 创建用户
|
||||
### 权限:需要 ADMIN 角色 + USER_CREATE 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`,重复用户名通常会失败
|
||||
### 请求参数:User,详见 ./http/object/user.md
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/create
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"name": "{{name}}",
|
||||
"nick": "{{nick}}",
|
||||
"email": "{{email}}",
|
||||
"phoneNo": "13800138000",
|
||||
"password": "{{password}}"
|
||||
}
|
||||
|
||||
### 更新用户
|
||||
### 权限:需要 ADMIN 角色 + USER_UPDATE 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`,`id` 必须存在
|
||||
### 请求参数:User,详见 ./http/object/user.md
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/update
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"id": "{{userId}}",
|
||||
"name": "{{name}}",
|
||||
"nick": "{{nick}}",
|
||||
"email": "{{email}}",
|
||||
"phoneNo": "13800138000"
|
||||
}
|
||||
|
||||
### 删除用户
|
||||
### 权限:需要 ADMIN 角色
|
||||
### 前置条件:需要先登录并回填 `user_token`,URL 参数 `id` 必须传有效用户 ID
|
||||
### 请求参数:无请求体,URL 参数:`id` 为用户 ID
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/delete?id={{userId}}
|
||||
Token: {{user_token}}
|
||||
|
||||
### 注册
|
||||
### 权限:无需登录
|
||||
### 前置条件:重复用户名通常会失败
|
||||
### 请求参数:User,详见 ./http/object/user.md
|
||||
### 返回参数:LoginResponse,详见 ./http/object/user.md
|
||||
POST {{baseUrl}}/user/register
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"name": "Test",
|
||||
"nick": "测试用户",
|
||||
"phoneNo": "13800138000",
|
||||
"password": "qwe123"
|
||||
}
|
||||
|
||||
### 登录
|
||||
### 权限:无需登录
|
||||
### 前置条件:成功后需要把响应中的 token 回填到 `user_token`
|
||||
### 请求参数:LoginRequest,详见 ./http/object/user.md
|
||||
### 返回参数:LoginResponse,详见 ./http/object/user.md
|
||||
POST {{baseUrl}}/user/login
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"user": "{{name}}",
|
||||
"password": "{{password}}"
|
||||
}
|
||||
|
||||
> {%
|
||||
client.global.set("user_token", response.body?.data?.token)
|
||||
%}
|
||||
|
||||
### 令牌登录
|
||||
### 权限:需要有效 Token
|
||||
### 前置条件:需要先登录并回填 `user_token`
|
||||
### 请求参数:无
|
||||
### 返回参数:LoginResponse,详见 ./http/object/user.md
|
||||
GET {{baseUrl}}/user/login/token
|
||||
Token: {{user_token}}
|
||||
|
||||
### 登出
|
||||
### 权限:当前控制器未声明 RequiredToken/权限注解,按服务端实际会话处理
|
||||
### 前置条件:当前接口通常用于退出当前登录态
|
||||
### 请求参数:无
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/logout
|
||||
Token: {{user_token}}
|
||||
|
||||
### 修改当前用户密码
|
||||
### 权限:需要 USER_UPDATE 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`
|
||||
### 请求参数:UpdatePasswordRequest,详见 ./http/object/user.md
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/update/password
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"oldValue": "{{password}}",
|
||||
"newValue": "{{newPassword}}"
|
||||
}
|
||||
|
||||
### 修改当前用户邮箱
|
||||
### 权限:需要 USER_UPDATE 权限
|
||||
### 前置条件:当前方法体为空,接口尚未实现
|
||||
### 请求参数:无
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/update/email
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{}
|
||||
|
||||
### 发送当前用户手机号验证码
|
||||
### 权限:需要 USER_UPDATE 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`
|
||||
### 请求参数:PhoneVerifyCodeSendRequest,详见 ./http/object/user.md
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/phone/verify/send
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"phoneNo": "13800138000"
|
||||
}
|
||||
|
||||
### 验证当前用户手机号
|
||||
### 权限:需要 USER_UPDATE 权限
|
||||
### 前置条件:需要先调用手机号验证码发送接口获取验证码
|
||||
### 请求参数:PhoneVerifyRequest,详见 ./http/object/user.md
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/phone/verify
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"phoneNo": "13800138000",
|
||||
"verifyCode": "123456"
|
||||
}
|
||||
|
||||
### 注销当前用户
|
||||
### 权限:需要 USER_DELETE 权限
|
||||
### 前置条件:需要先登录并回填 `user_token`
|
||||
### 请求参数:CancelRequest,详见 ./http/object/user.md
|
||||
### 返回参数:无
|
||||
POST {{baseUrl}}/user/cancel
|
||||
Content-Type: application/json
|
||||
Token: {{user_token}}
|
||||
|
||||
{
|
||||
"password": "{{password}}"
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<groupId>com.imyeyu.timiserverapi</groupId>
|
||||
<artifactId>TimiServerAPI</artifactId>
|
||||
<version>1.0.15</version>
|
||||
<version>1.0.69</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>TimiServerAPI</name>
|
||||
<description>imyeyu.com API</description>
|
||||
@@ -180,10 +180,19 @@
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy</artifactId>
|
||||
<version>4.0.29</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.imyeyu.spring</groupId>
|
||||
<artifactId>timi-spring</artifactId>
|
||||
<version>0.0.19</version>
|
||||
<version>0.0.20</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.imyeyu.network</groupId>
|
||||
@@ -198,17 +207,27 @@
|
||||
<dependency>
|
||||
<groupId>com.imyeyu.java</groupId>
|
||||
<artifactId>timi-java</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<version>0.0.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.imyeyu.utils</groupId>
|
||||
<artifactId>timi-utils</artifactId>
|
||||
<version>0.0.13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.majiajie</groupId>
|
||||
<artifactId>tinypinyin</artifactId>
|
||||
<version>2.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.hankcs</groupId>
|
||||
<artifactId>hanlp</artifactId>
|
||||
<version>portable-1.8.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.imyeyu.font.icon</groupId>
|
||||
<artifactId>timi-icon-font</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<version>0.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -236,9 +255,13 @@
|
||||
<artifactId>flyway-mysql</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.e2ins.ms.notify</groupId>
|
||||
<artifactId>e2ins-msg-notify-service-sdk</artifactId>
|
||||
<version>0.0.9</version>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
<artifactId>tencentcloud-sdk-java-sms</artifactId>
|
||||
<version>3.1.1281</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,35 +0,0 @@
|
||||
package com.imyeyu.api.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 启用配置注解
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2023-07-15 10:00
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface EnableSetting {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-27 14:45
|
||||
*/
|
||||
enum Logic {
|
||||
|
||||
AND,
|
||||
|
||||
OR
|
||||
}
|
||||
|
||||
Logic logic() default Logic.AND;
|
||||
|
||||
/** @return 未启用配置时响应消息语言映射键 */
|
||||
String message() default "service.offline";
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.imyeyu.api.annotation;
|
||||
|
||||
import com.imyeyu.api.modules.common.service.SettingService;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 启用配置注解处理器
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2023-07-15 10:01
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
|
||||
public class EnableSettingInterceptor implements HandlerInterceptor {
|
||||
|
||||
private final SettingService service;
|
||||
|
||||
public boolean preHandle(@NonNull HttpServletRequest req, @NonNull HttpServletResponse resp, @NonNull Object handler) throws InvocationTargetException, IllegalAccessException {
|
||||
if (handler instanceof HandlerMethod handlerMethod) {
|
||||
EnableSetting annotation = handlerMethod.getMethodAnnotation(EnableSetting.class);
|
||||
if (annotation == null) {
|
||||
return true;
|
||||
}
|
||||
EnableSetting.Logic logic = annotation.logic();
|
||||
List<Boolean> valueList = new ArrayList<>();
|
||||
for (Method method : annotation.getClass().getMethods()) {
|
||||
if (method.getName().equals("message")) {
|
||||
continue;
|
||||
}
|
||||
Enum<?>[] enums = (Enum<?>[]) method.invoke(annotation);
|
||||
for (Enum<?> anEnum : enums) {
|
||||
valueList.add(service.getSystem(anEnum).isTrue());
|
||||
}
|
||||
}
|
||||
if (logic == EnableSetting.Logic.AND) {
|
||||
return valueList.stream().allMatch(Boolean::booleanValue);
|
||||
} else {
|
||||
return valueList.stream().anyMatch(Boolean::booleanValue);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.imyeyu.api.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
///
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-09-08 15:22
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface SettingBizType {
|
||||
|
||||
String value();
|
||||
}
|
||||
@@ -45,11 +45,30 @@ public enum CorePermissionCode implements BuiltinPermissionCode {
|
||||
TAG_UPDATE("TAG:UPDATE", "标签修改", false, true),
|
||||
TAG_DELETE("TAG:DELETE", "标签删除", false, true),
|
||||
|
||||
ARTICLE_CREATE("ARTICLE:CREATE", "文章创建", false, true),
|
||||
ARTICLE_READ("ARTICLE:READ", "文章读取", false, true),
|
||||
ARTICLE_UPDATE("ARTICLE:UPDATE", "文章修改", false, true),
|
||||
ARTICLE_DELETE("ARTICLE:DELETE", "文章删除", false, true),
|
||||
|
||||
USER_CREATE("USER:CREATE", "用户创建", false, true),
|
||||
USER_READ("USER:READ", "用户读取", false, true),
|
||||
USER_UPDATE("USER:UPDATE", "用户修改", false, true),
|
||||
USER_DELETE("USER:DELETE", "用户删除", false, true),
|
||||
|
||||
API_KEY_CREATE("API_KEY:CREATE", "API 密钥创建", false, true),
|
||||
API_KEY_READ("API_KEY:READ", "API 密钥读取", false, true),
|
||||
API_KEY_DELETE("API_KEY:DELETE", "API 密钥删除", false, true),
|
||||
|
||||
FEEDBACK_CREATE("FEEDBACK:CREATE", "反馈创建", false, true),
|
||||
FEEDBACK_READ("FEEDBACK:READ", "反馈读取", false, true),
|
||||
FEEDBACK_UPDATE("FEEDBACK:UPDATE", "反馈修改", false, true),
|
||||
FEEDBACK_DELETE("FEEDBACK:DELETE", "反馈删除", false, true),
|
||||
|
||||
NOTIFY_CREATE("NOTIFY:CREATE", "通知创建", false, true),
|
||||
NOTIFY_READ("NOTIFY:READ", "通知读取", false, true),
|
||||
NOTIFY_DELETE("NOTIFY:DELETE", "通知删除", false, true),
|
||||
NOTIFY_CANCEL("NOTIFY:CANCEL", "通知取消", false, true),
|
||||
|
||||
USER_ROLE_CREATE("USER_ROLE:CREATE", "用户角色创建", true, true),
|
||||
USER_ROLE_READ("USER_ROLE:READ", "用户角色读取", true, true),
|
||||
USER_ROLE_DELETE("USER_ROLE:DELETE", "用户角色删除", true, true);
|
||||
|
||||
@@ -10,4 +10,6 @@ public enum ModuleCode {
|
||||
CORE,
|
||||
|
||||
GAO,
|
||||
|
||||
APP,
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.imyeyu.api.bean;
|
||||
|
||||
import com.imyeyu.api.annotation.SettingBizType;
|
||||
import com.imyeyu.api.modules.common.entity.Setting;
|
||||
import com.imyeyu.utils.Text;
|
||||
|
||||
///
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-09-08 15:18
|
||||
public interface SettingEnum {
|
||||
|
||||
default String getBizType() {
|
||||
Class<? extends SettingEnum> implEnum = getClass();
|
||||
SettingBizType bizType = implEnum.getAnnotation(SettingBizType.class);
|
||||
if (bizType == null) {
|
||||
return Text.bizClassName(implEnum);
|
||||
}
|
||||
return bizType.value();
|
||||
}
|
||||
|
||||
String name();
|
||||
|
||||
String getDefaultValue();
|
||||
|
||||
Setting.ValueType getValueType();
|
||||
}
|
||||
@@ -1,12 +1,9 @@
|
||||
package com.imyeyu.api.config;
|
||||
|
||||
import com.e2ins.ms.notify.SmsNotifyService;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.MapperFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.imyeyu.utils.Time;
|
||||
@@ -32,12 +29,6 @@ public class BeanConfig {
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SmsNotifyService smsNotifyService() {
|
||||
// TODO
|
||||
return new SmsNotifyService(null, null);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Yaml yaml() {
|
||||
return new Yaml();
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.imyeyu.api.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.imyeyu.api.modules.common.entity.Multilingual;
|
||||
import com.imyeyu.api.modules.gao.ai.entity.GaoAiSession;
|
||||
import com.imyeyu.api.modules.gao.bean.GaoUserInviteCache;
|
||||
import com.imyeyu.spring.bean.RedisConfigParams;
|
||||
import com.imyeyu.spring.config.AbstractRedisConfig;
|
||||
@@ -18,11 +19,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cache.interceptor.KeyGenerator;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.serializer.support.DeserializingConverter;
|
||||
import org.springframework.core.serializer.support.SerializingConverter;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.SerializationException;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
@@ -106,31 +102,7 @@ public class RedisConfig extends AbstractRedisConfig {
|
||||
/** @return 多语言环境,ID: {@link Multilingual} */
|
||||
@Bean("redisLanguage")
|
||||
public Redis<String, Multilingual> getLanguageRedisTemplate() {
|
||||
return getRedis(database, RedisSerializers.STRING, new RedisSerializer<>() {
|
||||
|
||||
public Multilingual deserialize(@Nullable byte[] bytes) {
|
||||
if (bytes == null || bytes.length == 0) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return (Multilingual) new DeserializingConverter().convert(bytes);
|
||||
} catch (Exception var3) {
|
||||
throw new SerializationException("Cannot deserialize", var3);
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] serialize(@Nullable Multilingual multilingual) {
|
||||
if (multilingual == null) {
|
||||
return new byte[0];
|
||||
} else {
|
||||
try {
|
||||
return new SerializingConverter().convert(multilingual);
|
||||
} catch (Exception var3) {
|
||||
throw new SerializationException("Cannot serialize", var3);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return getRedis(database, RedisSerializers.STRING, RedisSerializers.jacksonSerializer(jackson, Multilingual.class));
|
||||
}
|
||||
|
||||
@Bean("redisCaptcha")
|
||||
@@ -209,4 +181,10 @@ public class RedisConfig extends AbstractRedisConfig {
|
||||
public Redis<String, GaoUserInviteCache> getGaoUserInviteRedisTemplate() {
|
||||
return getRedis(database, RedisSerializers.STRING, RedisSerializers.jacksonSerializer(jackson, GaoUserInviteCache.class));
|
||||
}
|
||||
|
||||
/// @return AI 会话,AI 会话 ID: 会话授权内容
|
||||
@Bean("redisGaoAiSession")
|
||||
public Redis<String, GaoAiSession> getGaoAiSessionRedisTemplate() {
|
||||
return getRedis(database, RedisSerializers.STRING, RedisSerializers.jacksonSerializer(jackson, GaoAiSession.class));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,4 +32,22 @@ public class ThreadPoolConfig {
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
/// 创建操作审计线程池
|
||||
///
|
||||
/// @return 操作审计线程池
|
||||
@Bean(name = "auditTaskExecutor")
|
||||
public ThreadPoolTaskExecutor auditTaskExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(4);
|
||||
executor.setMaxPoolSize(8);
|
||||
executor.setQueueCapacity(2000);
|
||||
executor.setKeepAliveSeconds(60);
|
||||
executor.setWaitForTasksToCompleteOnShutdown(true);
|
||||
executor.setAwaitTerminationSeconds(60);
|
||||
executor.setThreadNamePrefix("audit-task-executor-");
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ import com.fasterxml.jackson.databind.MapperFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.imyeyu.api.annotation.EnableSettingInterceptor;
|
||||
import com.imyeyu.api.annotation.RequestRateLimitInterceptor;
|
||||
import com.imyeyu.api.annotation.RequireCorePermissionInterceptor;
|
||||
import com.imyeyu.api.modules.app.annotation.RequireAppPermissionInterceptor;
|
||||
import com.imyeyu.api.modules.gao.annotation.RequireGaoPermissionInterceptor;
|
||||
import com.imyeyu.api.modules.journal.util.JournalAPIInterceptor;
|
||||
import com.imyeyu.api.modules.system.util.SystemAPIInterceptor;
|
||||
@@ -40,10 +40,10 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
private final ObjectMapper jackson;
|
||||
private final SystemAPIInterceptor systemAPIInterceptor;
|
||||
private final JournalAPIInterceptor journalAPIInterceptor;
|
||||
private final EnableSettingInterceptor enableSettingInterceptor;
|
||||
private final RequestRateLimitInterceptor requestRateLimitInterceptor;
|
||||
private final RequireGaoPermissionInterceptor requireGaoPermissionInterceptor;
|
||||
private final RequireCorePermissionInterceptor requireCorePermissionInterceptor;
|
||||
private final RequireAppPermissionInterceptor requireAppPermissionInterceptor;
|
||||
|
||||
/**
|
||||
* 过滤器
|
||||
@@ -54,9 +54,9 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(systemAPIInterceptor).addPathPatterns(SystemAPIInterceptor.PATH);
|
||||
registry.addInterceptor(journalAPIInterceptor).addPathPatterns(JournalAPIInterceptor.PATH);
|
||||
registry.addInterceptor(enableSettingInterceptor).addPathPatterns("/**");
|
||||
registry.addInterceptor(requireCorePermissionInterceptor).addPathPatterns("/**");
|
||||
registry.addInterceptor(requireGaoPermissionInterceptor).addPathPatterns("/**");
|
||||
registry.addInterceptor(requireAppPermissionInterceptor).addPathPatterns("/**");
|
||||
registry.addInterceptor(requestRateLimitInterceptor).addPathPatterns("/**");
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ import java.util.List;
|
||||
"com.imyeyu.api.modules.mirror.mapper",
|
||||
"com.imyeyu.api.modules.system.mapper",
|
||||
"com.imyeyu.api.modules.common.mapper",
|
||||
"com.imyeyu.api.modules.app.mapper",
|
||||
"com.imyeyu.api.modules.journal.mapper",
|
||||
"com.imyeyu.api.modules.minecraft.mapper"
|
||||
}, sqlSessionFactoryRef = "timiServerSqlSessionFactory")
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.imyeyu.api.modules.app.annotation;
|
||||
|
||||
import com.imyeyu.api.bean.PermissionMatchMode;
|
||||
import com.imyeyu.api.modules.app.bean.AppPermissionCode;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
///
|
||||
/// 要求 APP 模块权限
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-11-06
|
||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface RequireAppPermission {
|
||||
|
||||
/// 所需权限
|
||||
///
|
||||
/// @return 权限列表
|
||||
AppPermissionCode[] value();
|
||||
|
||||
/// 匹配模式
|
||||
///
|
||||
/// @return 匹配模式
|
||||
PermissionMatchMode mode() default PermissionMatchMode.ALL;
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.imyeyu.api.modules.app.annotation;
|
||||
|
||||
import com.imyeyu.api.bean.ModuleCode;
|
||||
import com.imyeyu.api.bean.PermissionMatchMode;
|
||||
import com.imyeyu.api.modules.app.bean.AppPermissionCode;
|
||||
import com.imyeyu.api.modules.user.service.PermissionChecker;
|
||||
import com.imyeyu.java.TimiJava;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
///
|
||||
/// APP 权限注解处理器
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-11-06
|
||||
@Component
|
||||
public class RequireAppPermissionInterceptor implements HandlerInterceptor {
|
||||
|
||||
private final PermissionChecker permissionChecker;
|
||||
|
||||
public RequireAppPermissionInterceptor(PermissionChecker permissionChecker) {
|
||||
this.permissionChecker = permissionChecker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preHandle(@NonNull HttpServletRequest req, @NonNull HttpServletResponse resp, @NonNull Object handler) {
|
||||
if (!(handler instanceof HandlerMethod handlerMethod)) {
|
||||
return true;
|
||||
}
|
||||
RequireAppPermission annotation = handlerMethod.getMethodAnnotation(RequireAppPermission.class);
|
||||
if (annotation == null || TimiJava.isEmpty(annotation.value())) {
|
||||
return true;
|
||||
}
|
||||
String[] permissionCodeList = Arrays.stream(annotation.value()).map(AppPermissionCode::getValue).toArray(String[]::new);
|
||||
if (annotation.mode() == PermissionMatchMode.ANY) {
|
||||
permissionChecker.checkAny(ModuleCode.APP, permissionCodeList);
|
||||
} else {
|
||||
permissionChecker.checkAll(ModuleCode.APP, permissionCodeList);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.imyeyu.api.modules.app.bean;
|
||||
|
||||
import com.imyeyu.api.bean.ModuleCode;
|
||||
import com.imyeyu.api.modules.user.bean.BuiltinPermissionCode;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
///
|
||||
/// APP 模块权限枚举
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-11-06
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AppPermissionCode implements BuiltinPermissionCode {
|
||||
|
||||
APP_PRODUCT_CREATE("APP_PRODUCT:CREATE", "应用产品创建", false, true),
|
||||
APP_PRODUCT_READ("APP_PRODUCT:READ", "应用产品读取", false, true),
|
||||
APP_PRODUCT_UPDATE("APP_PRODUCT:UPDATE", "应用产品修改", false, true),
|
||||
APP_PRODUCT_DELETE("APP_PRODUCT:DELETE", "应用产品删除", false, true),
|
||||
|
||||
APP_CHANNEL_CREATE("APP_CHANNEL:CREATE", "应用通道创建", false, true),
|
||||
APP_CHANNEL_DELETE("APP_CHANNEL:DELETE", "应用通道删除", false, true),
|
||||
|
||||
APP_RELEASE_CREATE("APP_RELEASE:CREATE", "应用发布创建", false, true),
|
||||
APP_RELEASE_READ("APP_RELEASE:READ", "应用发布读取", false, true),
|
||||
APP_RELEASE_PUBLISH("APP_RELEASE:PUBLISH", "应用发布上线", false, true),
|
||||
APP_RELEASE_ROLLBACK("APP_RELEASE:ROLLBACK", "应用发布回滚", false, true),
|
||||
APP_RELEASE_REVOKE("APP_RELEASE:REVOKE", "应用发布撤回", false, true),
|
||||
APP_RELEASE_DELETE("APP_RELEASE:DELETE", "应用发布删除", false, true);
|
||||
|
||||
private final String value;
|
||||
|
||||
private final String defaultName;
|
||||
|
||||
private final boolean grantToSystem;
|
||||
|
||||
private final boolean grantToAdmin;
|
||||
|
||||
/// 权限模块
|
||||
///
|
||||
/// @return 模块代码
|
||||
@Override
|
||||
public ModuleCode getModuleCode() {
|
||||
return ModuleCode.APP;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
package com.imyeyu.api.modules.app.controller;
|
||||
|
||||
import com.imyeyu.api.modules.app.annotation.RequireAppPermission;
|
||||
import com.imyeyu.api.modules.app.bean.AppPermissionCode;
|
||||
import com.imyeyu.api.modules.app.entity.AppChannel;
|
||||
import com.imyeyu.api.modules.app.entity.AppProduct;
|
||||
import com.imyeyu.api.modules.app.entity.AppRelease;
|
||||
import com.imyeyu.api.modules.app.service.AppVersionService;
|
||||
import com.imyeyu.api.modules.user.service.UserLoginService;
|
||||
import com.imyeyu.spring.annotation.AOPLog;
|
||||
import com.imyeyu.spring.annotation.RequestRateLimit;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
///
|
||||
/// 应用发布管理接口
|
||||
///
|
||||
/// 操作人一律取当前登录身份,不接受请求参数指定
|
||||
/// 用 API Key 调用时为密钥归属用户,用登录令牌调用时为登录用户
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-11-06
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/app")
|
||||
public class AppReleaseController {
|
||||
|
||||
private final AppVersionService service;
|
||||
private final UserLoginService userLoginService;
|
||||
|
||||
/// 查询产品列表
|
||||
///
|
||||
/// @return 产品列表
|
||||
@RequireAppPermission(AppPermissionCode.APP_PRODUCT_READ)
|
||||
@RequestRateLimit
|
||||
@PostMapping("/product/list")
|
||||
public List<AppProduct> productList() {
|
||||
return service.listProducts();
|
||||
}
|
||||
|
||||
/// 保存产品
|
||||
///
|
||||
/// @param product 产品
|
||||
/// @return 保存后的产品
|
||||
@AOPLog
|
||||
@RequireAppPermission({AppPermissionCode.APP_PRODUCT_CREATE, AppPermissionCode.APP_PRODUCT_UPDATE})
|
||||
@RequestRateLimit
|
||||
@PostMapping("/product/save")
|
||||
public AppProduct productSave(@RequestBody AppProduct product) {
|
||||
return service.saveProduct(product);
|
||||
}
|
||||
|
||||
/// 查询发布列表
|
||||
///
|
||||
/// @param productId 产品 ID
|
||||
/// @return 发布列表
|
||||
@RequireAppPermission(AppPermissionCode.APP_RELEASE_READ)
|
||||
@RequestRateLimit
|
||||
@GetMapping("/release/list")
|
||||
public List<AppRelease> releaseList(@RequestParam String productId) {
|
||||
return service.listReleases(productId);
|
||||
}
|
||||
|
||||
/// 创建发布记录
|
||||
///
|
||||
/// @param release 发布记录
|
||||
/// @return 创建后的记录
|
||||
@AOPLog
|
||||
@RequireAppPermission(AppPermissionCode.APP_RELEASE_CREATE)
|
||||
@RequestRateLimit
|
||||
@PostMapping("/release/create")
|
||||
public AppRelease releaseCreate(@RequestBody AppRelease release) {
|
||||
return service.create(release, operator());
|
||||
}
|
||||
|
||||
/// 发布版本
|
||||
///
|
||||
/// @param releaseId 发布 ID
|
||||
/// @param channelCode 通道代码
|
||||
/// @param grayPermille 灰度比例,万分比
|
||||
/// @param note 变更说明
|
||||
@AOPLog
|
||||
@RequireAppPermission(AppPermissionCode.APP_RELEASE_PUBLISH)
|
||||
@RequestRateLimit
|
||||
@PostMapping("/release/publish")
|
||||
public void publish(
|
||||
@RequestParam String releaseId,
|
||||
@RequestParam(defaultValue = AppVersionService.DEFAULT_CHANNEL) String channelCode,
|
||||
@RequestParam(required = false) Integer grayPermille,
|
||||
@RequestParam(required = false) String note
|
||||
) {
|
||||
service.publish(releaseId, channelCode, grayPermille, operator(), note);
|
||||
}
|
||||
|
||||
/// 回滚通道到指定版本
|
||||
///
|
||||
/// @param productId 产品 ID
|
||||
/// @param channelCode 通道代码
|
||||
/// @param targetReleaseId 目标发布 ID
|
||||
@AOPLog
|
||||
@RequireAppPermission(AppPermissionCode.APP_RELEASE_ROLLBACK)
|
||||
@RequestRateLimit
|
||||
@PostMapping("/release/rollback")
|
||||
public void rollback(
|
||||
@RequestParam String productId,
|
||||
@RequestParam(defaultValue = AppVersionService.DEFAULT_CHANNEL) String channelCode,
|
||||
@RequestParam String targetReleaseId
|
||||
) {
|
||||
service.rollback(productId, channelCode, targetReleaseId, operator());
|
||||
}
|
||||
|
||||
/// 撤回发布
|
||||
///
|
||||
/// @param releaseId 发布 ID
|
||||
@AOPLog
|
||||
@RequireAppPermission(AppPermissionCode.APP_RELEASE_REVOKE)
|
||||
@RequestRateLimit
|
||||
@PostMapping("/release/revoke")
|
||||
public void revoke(@RequestParam String releaseId) {
|
||||
service.revoke(releaseId, operator());
|
||||
}
|
||||
|
||||
/// 查询通道列表
|
||||
///
|
||||
/// @param productId 产品 ID
|
||||
/// @return 通道列表
|
||||
@RequireAppPermission(AppPermissionCode.APP_RELEASE_READ)
|
||||
@RequestRateLimit
|
||||
@GetMapping("/channel/list")
|
||||
public List<AppChannel> channelList(@RequestParam String productId) {
|
||||
return service.listChannels(productId);
|
||||
}
|
||||
|
||||
/// 删除草稿发布
|
||||
///
|
||||
/// @param releaseId 发布 ID
|
||||
@AOPLog
|
||||
@RequireAppPermission(AppPermissionCode.APP_RELEASE_DELETE)
|
||||
@RequestRateLimit
|
||||
@PostMapping("/release/delete")
|
||||
public void releaseDelete(@RequestParam String releaseId) {
|
||||
service.deleteRelease(releaseId, operator());
|
||||
}
|
||||
|
||||
/// 删除通道
|
||||
///
|
||||
/// @param channelId 通道 ID
|
||||
@AOPLog
|
||||
@RequireAppPermission(AppPermissionCode.APP_CHANNEL_DELETE)
|
||||
@RequestRateLimit
|
||||
@PostMapping("/channel/delete")
|
||||
public void channelDelete(@RequestParam String channelId) {
|
||||
service.deleteChannel(channelId, operator());
|
||||
}
|
||||
|
||||
/// 删除产品
|
||||
///
|
||||
/// @param productId 产品 ID
|
||||
@AOPLog
|
||||
@RequireAppPermission(AppPermissionCode.APP_PRODUCT_DELETE)
|
||||
@RequestRateLimit
|
||||
@PostMapping("/product/delete")
|
||||
public void productDelete(@RequestParam String productId) {
|
||||
service.deleteProduct(productId, operator());
|
||||
}
|
||||
|
||||
/// 取当前操作人
|
||||
///
|
||||
/// 接口都带权限注解,执行到这里一定已登录,取不到会直接抛错
|
||||
///
|
||||
/// @return 当前登录用户 ID
|
||||
private String operator() {
|
||||
return userLoginService.getRequireLoginUserId();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.imyeyu.api.modules.app.controller;
|
||||
|
||||
import com.imyeyu.api.modules.app.service.AppVersionService;
|
||||
import com.imyeyu.api.modules.app.vo.AppUpdateCheckRequest;
|
||||
import com.imyeyu.api.modules.app.vo.AppUpdateCheckResponse;
|
||||
import com.imyeyu.spring.annotation.IgnoreGlobalReturn;
|
||||
import com.imyeyu.spring.annotation.RequestRateLimit;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
///
|
||||
/// 应用更新接口
|
||||
///
|
||||
/// 供 Capacitor 插件直接调用,不要求登录态,因此不加权限注解
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-11-06
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/app/update")
|
||||
public class AppUpdateController {
|
||||
|
||||
private final AppVersionService service;
|
||||
|
||||
/// 检查更新
|
||||
///
|
||||
/// 直接返回插件要求的原始 JSON,不能套通用响应包装
|
||||
///
|
||||
/// @param req 插件上报信息
|
||||
/// @return 插件协议响应
|
||||
@IgnoreGlobalReturn
|
||||
@RequestRateLimit
|
||||
@PostMapping("/check")
|
||||
public AppUpdateCheckResponse check(@RequestBody AppUpdateCheckRequest req) {
|
||||
return service.check(req);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.imyeyu.api.modules.app.entity;
|
||||
|
||||
import com.imyeyu.spring.entity.UUIDEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
///
|
||||
/// 应用发布通道
|
||||
///
|
||||
/// 通道只持有一个指针,回滚就是改指向,发布记录本身不可变
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-11-06
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AppChannel extends UUIDEntity {
|
||||
|
||||
/// 产品 ID
|
||||
protected String productId;
|
||||
|
||||
/// 通道代码,如 stable、beta
|
||||
protected String code;
|
||||
|
||||
/// 通道名称
|
||||
protected String name;
|
||||
|
||||
/// 当前指向的发布 ID,为空表示该通道无发布
|
||||
protected String releaseId;
|
||||
|
||||
/// 最后操作人用户 ID
|
||||
protected String updatedBy;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.imyeyu.api.modules.app.entity;
|
||||
|
||||
import com.imyeyu.spring.entity.UUIDEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
///
|
||||
/// 应用产品
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-11-06
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AppProduct extends UUIDEntity {
|
||||
|
||||
/// 平台
|
||||
public enum Platform {
|
||||
|
||||
/// Android
|
||||
ANDROID,
|
||||
|
||||
/// iOS
|
||||
IOS
|
||||
}
|
||||
|
||||
/// 产品标识,取 Capacitor appId
|
||||
protected String appKey;
|
||||
|
||||
/// 产品名称
|
||||
protected String name;
|
||||
|
||||
/// 平台
|
||||
protected Platform platform;
|
||||
|
||||
/// 包名
|
||||
protected String packageName;
|
||||
|
||||
/// 检查接口密钥,为空时不校验
|
||||
protected String updateKey;
|
||||
|
||||
/// true 为允许检查更新
|
||||
protected Boolean enabled;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.imyeyu.api.modules.app.entity;
|
||||
|
||||
import com.imyeyu.spring.entity.UUIDEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
///
|
||||
/// 应用发布记录
|
||||
///
|
||||
/// 创建后不可变,回滚只改通道指针,不修改本记录
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-11-06
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AppRelease extends UUIDEntity {
|
||||
|
||||
/// 产物类型
|
||||
public enum Kind {
|
||||
|
||||
/// 原生安装包
|
||||
NATIVE,
|
||||
|
||||
/// Web 热更包
|
||||
BUNDLE
|
||||
}
|
||||
|
||||
/// 发布状态
|
||||
public enum Status {
|
||||
|
||||
/// 待发布
|
||||
DRAFT,
|
||||
|
||||
/// 已发布
|
||||
PUBLISHED,
|
||||
|
||||
/// 已撤回
|
||||
REVOKED
|
||||
}
|
||||
|
||||
/// 产品 ID
|
||||
protected String productId;
|
||||
|
||||
/// 产物类型
|
||||
protected Kind kind;
|
||||
|
||||
/// 版本号,热更包为 semver
|
||||
protected String versionName;
|
||||
|
||||
/// 原生 versionCode,kind 为 NATIVE 时必填
|
||||
protected Integer versionCode;
|
||||
|
||||
/// 兼容的最低原生 versionCode,kind 为 BUNDLE 时必填
|
||||
protected Integer minVersionCode;
|
||||
|
||||
/// 兼容的最高原生 versionCode,为空表示不限
|
||||
protected Integer maxVersionCode;
|
||||
|
||||
/// 产物附件 ID
|
||||
protected String attachmentId;
|
||||
|
||||
/// 产物字节数
|
||||
protected Long artifactSize;
|
||||
|
||||
/// 产物 SHA-256
|
||||
protected String sha256;
|
||||
|
||||
/// 灰度比例,万分比,10000 为全量
|
||||
protected Integer grayPermille;
|
||||
|
||||
/// true 为强制更新,仅 kind 为 NATIVE 时有效
|
||||
protected Boolean mandatory;
|
||||
|
||||
/// 发布状态
|
||||
protected Status status;
|
||||
|
||||
/// 变更说明
|
||||
protected String note;
|
||||
|
||||
/// 发布人用户 ID
|
||||
protected String createdBy;
|
||||
|
||||
/// 首次发布时间
|
||||
protected Long publishedAt;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.imyeyu.api.modules.app.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.app.entity.AppChannel;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
///
|
||||
/// 应用发布通道
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-11-06
|
||||
public interface AppChannelMapper extends BaseMapper<AppChannel, String> {
|
||||
|
||||
/// 按产品与通道代码查询
|
||||
///
|
||||
/// @param productId 产品 ID
|
||||
/// @param code 通道代码
|
||||
/// @return 通道
|
||||
@Select("SELECT * FROM app_channel WHERE product_id = #{productId} AND code = #{code} AND deleted_at IS NULL LIMIT 1")
|
||||
AppChannel selectByProductAndCode(@Param("productId") String productId, @Param("code") String code);
|
||||
|
||||
/// 按产品查询通道列表
|
||||
///
|
||||
/// @param productId 产品 ID
|
||||
/// @return 通道列表
|
||||
@Select("SELECT * FROM app_channel WHERE product_id = #{productId} AND deleted_at IS NULL ORDER BY code")
|
||||
List<AppChannel> selectByProduct(@Param("productId") String productId);
|
||||
|
||||
/// 切换通道指针
|
||||
///
|
||||
/// @param id 通道 ID
|
||||
/// @param releaseId 目标发布 ID,为空表示指向空
|
||||
/// @param updatedBy 操作人用户 ID
|
||||
/// @param updatedAt 更新时间
|
||||
/// @return 影响行数
|
||||
@Update("UPDATE app_channel SET release_id = #{releaseId}, updated_by = #{updatedBy}, updated_at = #{updatedAt} WHERE id = #{id}")
|
||||
int updateReleaseId(
|
||||
@Param("id") String id,
|
||||
@Param("releaseId") String releaseId,
|
||||
@Param("updatedBy") String updatedBy,
|
||||
@Param("updatedAt") Long updatedAt
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.imyeyu.api.modules.app.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.app.entity.AppProduct;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
///
|
||||
/// 应用产品
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-11-06
|
||||
public interface AppProductMapper extends BaseMapper<AppProduct, String> {
|
||||
|
||||
/// 按产品标识查询
|
||||
///
|
||||
/// @param appKey 产品标识
|
||||
/// @param platform 平台
|
||||
/// @return 产品
|
||||
@Select("SELECT * FROM app_product WHERE app_key = #{appKey} AND platform = #{platform} AND deleted_at IS NULL LIMIT 1")
|
||||
AppProduct selectByAppKey(@Param("appKey") String appKey, @Param("platform") AppProduct.Platform platform);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.imyeyu.api.modules.app.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.app.entity.AppRelease;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
///
|
||||
/// 应用发布记录
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-11-06
|
||||
public interface AppReleaseMapper extends BaseMapper<AppRelease, String> {
|
||||
|
||||
/// 查询产品下已发布的同类型产物
|
||||
///
|
||||
/// @param productId 产品 ID
|
||||
/// @param kind 产物类型
|
||||
/// @return 发布列表,按发布时间倒序
|
||||
@Select("SELECT * FROM app_release WHERE product_id = #{productId} AND kind = #{kind} AND status = 'PUBLISHED' AND deleted_at IS NULL ORDER BY published_at DESC")
|
||||
List<AppRelease> selectPublished(@Param("productId") String productId, @Param("kind") AppRelease.Kind kind);
|
||||
|
||||
/// 按版本号查询
|
||||
///
|
||||
/// @param productId 产品 ID
|
||||
/// @param kind 产物类型
|
||||
/// @param versionName 版本号
|
||||
/// @return 发布记录
|
||||
@Select("SELECT * FROM app_release WHERE product_id = #{productId} AND kind = #{kind} AND version_name = #{versionName} AND deleted_at IS NULL LIMIT 1")
|
||||
AppRelease selectByVersion(
|
||||
@Param("productId") String productId,
|
||||
@Param("kind") AppRelease.Kind kind,
|
||||
@Param("versionName") String versionName
|
||||
);
|
||||
|
||||
/// 查询产品下全部发布记录
|
||||
///
|
||||
/// @param productId 产品 ID
|
||||
/// @return 发布列表,按创建时间倒序
|
||||
@Select("SELECT * FROM app_release WHERE product_id = #{productId} AND deleted_at IS NULL ORDER BY created_at DESC")
|
||||
List<AppRelease> selectByProduct(@Param("productId") String productId);
|
||||
}
|
||||
@@ -0,0 +1,435 @@
|
||||
package com.imyeyu.api.modules.app.service;
|
||||
|
||||
import com.imyeyu.api.modules.app.entity.AppChannel;
|
||||
import com.imyeyu.api.modules.app.entity.AppProduct;
|
||||
import com.imyeyu.api.modules.app.entity.AppRelease;
|
||||
import com.imyeyu.api.modules.app.mapper.AppChannelMapper;
|
||||
import com.imyeyu.api.modules.app.mapper.AppProductMapper;
|
||||
import com.imyeyu.api.modules.app.mapper.AppReleaseMapper;
|
||||
import com.imyeyu.api.modules.app.vo.AppUpdateCheckRequest;
|
||||
import com.imyeyu.api.modules.app.vo.AppUpdateCheckResponse;
|
||||
import com.imyeyu.api.modules.system.entity.Logger;
|
||||
import com.imyeyu.api.modules.system.service.LoggerService;
|
||||
import com.imyeyu.java.TimiJava;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.zip.CRC32;
|
||||
|
||||
///
|
||||
/// 应用版本服务
|
||||
///
|
||||
/// 核心只有一个判断:给定设备当前状态和通道,它此刻应该运行哪一份产物
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-11-06
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AppVersionService {
|
||||
|
||||
/// 默认通道
|
||||
public static final String DEFAULT_CHANNEL = "stable";
|
||||
|
||||
/// 内置包版本标识
|
||||
public static final String BUILTIN_VERSION = "builtin";
|
||||
|
||||
/// 灰度基数
|
||||
private static final long GRAY_BASE = 10000L;
|
||||
|
||||
private final AppProductMapper productMapper;
|
||||
private final AppChannelMapper channelMapper;
|
||||
private final AppReleaseMapper releaseMapper;
|
||||
private final LoggerService loggerService;
|
||||
|
||||
/// 检查更新
|
||||
///
|
||||
/// @param req 插件上报信息
|
||||
/// @return 插件协议响应,无更新时回显当前版本
|
||||
public AppUpdateCheckResponse check(AppUpdateCheckRequest req) {
|
||||
String currentVersion = TimiJava.isEmpty(req.getVersionName()) ? BUILTIN_VERSION : req.getVersionName();
|
||||
AppProduct product = productMapper.selectByAppKey(req.getAppId(), parsePlatform(req.getPlatform()));
|
||||
if (product == null || !Boolean.TRUE.equals(product.getEnabled())) {
|
||||
log.warn("应用不存在或已停用,appId={}", req.getAppId());
|
||||
return AppUpdateCheckResponse.none(currentVersion);
|
||||
}
|
||||
if (!TimiJava.isEmpty(product.getUpdateKey()) && !product.getUpdateKey().equals(req.getKey())) {
|
||||
log.warn("更新密钥不匹配,appId={}", req.getAppId());
|
||||
return AppUpdateCheckResponse.none(currentVersion);
|
||||
}
|
||||
String channelCode = TimiJava.isEmpty(req.getChannel()) ? DEFAULT_CHANNEL : req.getChannel();
|
||||
AppChannel channel = channelMapper.selectByProductAndCode(product.getId(), channelCode);
|
||||
if (channel == null || TimiJava.isEmpty(channel.getReleaseId())) {
|
||||
return AppUpdateCheckResponse.none(currentVersion);
|
||||
}
|
||||
AppRelease release = releaseMapper.select(channel.getReleaseId());
|
||||
if (release == null || release.getStatus() != AppRelease.Status.PUBLISHED) {
|
||||
return AppUpdateCheckResponse.none(currentVersion);
|
||||
}
|
||||
int currentCode = parseInt(req.getVersionCode(), 0);
|
||||
if (release.getKind() == AppRelease.Kind.NATIVE) {
|
||||
return resolveNative(release, currentCode, currentVersion);
|
||||
}
|
||||
return resolveBundle(release, product, currentCode, currentVersion, req.getDeviceId());
|
||||
}
|
||||
|
||||
/// 原生包更新判断
|
||||
///
|
||||
/// @param release 发布记录
|
||||
/// @param currentCode 当前原生 versionCode
|
||||
/// @param currentVersion 当前版本名
|
||||
/// @return 更新响应
|
||||
private AppUpdateCheckResponse resolveNative(AppRelease release, int currentCode, String currentVersion) {
|
||||
if (release.getVersionCode() == null || release.getVersionCode() <= currentCode) {
|
||||
return AppUpdateCheckResponse.none(currentVersion);
|
||||
}
|
||||
return buildResponse(release, Boolean.TRUE.equals(release.getMandatory()));
|
||||
}
|
||||
|
||||
/// 热更包更新判断
|
||||
///
|
||||
/// @param release 发布记录
|
||||
/// @param product 产品
|
||||
/// @param currentCode 当前原生 versionCode
|
||||
/// @param currentVersion 当前 Web 包版本
|
||||
/// @param deviceId 设备标识
|
||||
/// @return 更新响应
|
||||
private AppUpdateCheckResponse resolveBundle(
|
||||
AppRelease release,
|
||||
AppProduct product,
|
||||
int currentCode,
|
||||
String currentVersion,
|
||||
String deviceId
|
||||
) {
|
||||
// 原生版本不在兼容区间内,装了会崩
|
||||
if (release.getMinVersionCode() != null && currentCode < release.getMinVersionCode()) {
|
||||
return AppUpdateCheckResponse.none(currentVersion);
|
||||
}
|
||||
if (release.getMaxVersionCode() != null && release.getMaxVersionCode() < currentCode) {
|
||||
return AppUpdateCheckResponse.none(currentVersion);
|
||||
}
|
||||
// 已是最新,或低于当前版本时不做降级
|
||||
if (release.getVersionName().equals(currentVersion)) {
|
||||
return AppUpdateCheckResponse.none(currentVersion);
|
||||
}
|
||||
if (0 < compareVersion(currentVersion, release.getVersionName())) {
|
||||
return AppUpdateCheckResponse.none(currentVersion);
|
||||
}
|
||||
// 灰度分桶不能含 releaseId,否则每次发版都会重排用户
|
||||
if (!hitGray(release.getGrayPermille(), deviceId, product.getAppKey())) {
|
||||
return AppUpdateCheckResponse.none(currentVersion);
|
||||
}
|
||||
return buildResponse(release, false);
|
||||
}
|
||||
|
||||
/// 判断设备是否命中灰度
|
||||
///
|
||||
/// @param grayPermille 灰度比例,万分比
|
||||
/// @param deviceId 设备标识
|
||||
/// @param appKey 产品标识
|
||||
/// @return true 为命中
|
||||
private boolean hitGray(Integer grayPermille, String deviceId, String appKey) {
|
||||
if (grayPermille == null || GRAY_BASE <= grayPermille) {
|
||||
return true;
|
||||
}
|
||||
if (TimiJava.isEmpty(deviceId)) {
|
||||
return false;
|
||||
}
|
||||
CRC32 crc = new CRC32();
|
||||
crc.update((deviceId + ":" + appKey).getBytes(StandardCharsets.UTF_8));
|
||||
return crc.getValue() % GRAY_BASE < grayPermille;
|
||||
}
|
||||
|
||||
/// 构造更新响应
|
||||
///
|
||||
/// @param release 发布记录
|
||||
/// @param mandatory true 为强制更新
|
||||
/// @return 更新响应
|
||||
private AppUpdateCheckResponse buildResponse(AppRelease release, boolean mandatory) {
|
||||
String url = ServletUriComponentsBuilder.fromCurrentContextPath()
|
||||
.path("/attach/download/")
|
||||
.path(release.getAttachmentId())
|
||||
.toUriString();
|
||||
return new AppUpdateCheckResponse(release.getVersionName(), url, release.getSha256(), mandatory);
|
||||
}
|
||||
|
||||
/// 比较版本号
|
||||
///
|
||||
/// 只处理数字段,预发布标识按 0 处理
|
||||
///
|
||||
/// @param a 版本 A
|
||||
/// @param b 版本 B
|
||||
/// @return 负数表示 A 小于 B
|
||||
private int compareVersion(String a, String b) {
|
||||
if (BUILTIN_VERSION.equals(a)) {
|
||||
return -1;
|
||||
}
|
||||
if (BUILTIN_VERSION.equals(b)) {
|
||||
return 1;
|
||||
}
|
||||
String[] left = a.split("\\.");
|
||||
String[] right = b.split("\\.");
|
||||
int length = Math.max(left.length, right.length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
int x = i < left.length ? parseInt(left[i], 0) : 0;
|
||||
int y = i < right.length ? parseInt(right[i], 0) : 0;
|
||||
if (x != y) {
|
||||
return 0 < Integer.compare(x, y) ? 1 : -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// 安全解析整数
|
||||
///
|
||||
/// @param value 原始值
|
||||
/// @param defaultValue 默认值
|
||||
/// @return 解析结果
|
||||
private int parseInt(String value, int defaultValue) {
|
||||
if (TimiJava.isEmpty(value)) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
return Integer.parseInt(value.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// 解析平台
|
||||
///
|
||||
/// @param platform 平台字符串
|
||||
/// @return 平台枚举
|
||||
private AppProduct.Platform parsePlatform(String platform) {
|
||||
if (TimiJava.isEmpty(platform)) {
|
||||
return AppProduct.Platform.ANDROID;
|
||||
}
|
||||
try {
|
||||
return AppProduct.Platform.valueOf(platform.trim().toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return AppProduct.Platform.ANDROID;
|
||||
}
|
||||
}
|
||||
|
||||
/// 发布版本
|
||||
///
|
||||
/// @param releaseId 发布 ID
|
||||
/// @param channelCode 通道代码
|
||||
/// @param grayPermille 灰度比例,为空时保持原值
|
||||
/// @param operatorId 操作人用户 ID
|
||||
/// @param note 变更说明
|
||||
public void publish(String releaseId, String channelCode, Integer grayPermille, String operatorId, String note) {
|
||||
AppRelease release = releaseMapper.select(releaseId);
|
||||
if (release == null) {
|
||||
throw new IllegalArgumentException("发布记录不存在");
|
||||
}
|
||||
AppChannel channel = channelMapper.selectByProductAndCode(release.getProductId(), channelCode);
|
||||
if (channel == null) {
|
||||
throw new IllegalArgumentException("通道不存在");
|
||||
}
|
||||
checkCompatibility(release);
|
||||
Long now = System.currentTimeMillis();
|
||||
// 发布不指定灰度按全量处理:草稿默认是 0,直接沿用会让所有设备都拿不到包
|
||||
release.setGrayPermille(grayPermille == null ? (int) GRAY_BASE : grayPermille);
|
||||
release.setStatus(AppRelease.Status.PUBLISHED);
|
||||
if (release.getPublishedAt() == null) {
|
||||
release.setPublishedAt(now);
|
||||
}
|
||||
release.setNote(TimiJava.isEmpty(note) ? release.getNote() : note);
|
||||
release.setUpdatedAt(now);
|
||||
releaseMapper.updateSelective(release);
|
||||
channelMapper.updateReleaseId(channel.getId(), releaseId, operatorId, now);
|
||||
log("APP_RELEASE_PUBLISH", releaseId);
|
||||
}
|
||||
|
||||
/// 回滚通道到指定发布
|
||||
///
|
||||
/// 回滚只改指针,同时把目标版本灰度拉满,否则只有部分设备能回退
|
||||
///
|
||||
/// @param productId 产品 ID
|
||||
/// @param channelCode 通道代码
|
||||
/// @param targetReleaseId 目标发布 ID
|
||||
/// @param operatorId 操作人用户 ID
|
||||
public void rollback(String productId, String channelCode, String targetReleaseId, String operatorId) {
|
||||
AppChannel channel = channelMapper.selectByProductAndCode(productId, channelCode);
|
||||
if (channel == null) {
|
||||
throw new IllegalArgumentException("通道不存在");
|
||||
}
|
||||
AppRelease target = releaseMapper.select(targetReleaseId);
|
||||
if (target == null || !target.getProductId().equals(productId)) {
|
||||
throw new IllegalArgumentException("目标发布不存在");
|
||||
}
|
||||
Long now = System.currentTimeMillis();
|
||||
target.setGrayPermille((int) GRAY_BASE);
|
||||
target.setStatus(AppRelease.Status.PUBLISHED);
|
||||
target.setUpdatedAt(now);
|
||||
releaseMapper.updateSelective(target);
|
||||
channelMapper.updateReleaseId(channel.getId(), targetReleaseId, operatorId, now);
|
||||
log("APP_RELEASE_ROLLBACK", targetReleaseId);
|
||||
}
|
||||
|
||||
/// 撤回发布
|
||||
///
|
||||
/// @param releaseId 发布 ID
|
||||
/// @param operatorId 操作人用户 ID
|
||||
public void revoke(String releaseId, String operatorId) {
|
||||
AppRelease release = releaseMapper.select(releaseId);
|
||||
if (release == null) {
|
||||
throw new IllegalArgumentException("发布记录不存在");
|
||||
}
|
||||
Long now = System.currentTimeMillis();
|
||||
release.setStatus(AppRelease.Status.REVOKED);
|
||||
release.setUpdatedAt(now);
|
||||
releaseMapper.updateSelective(release);
|
||||
AppChannel channel = channelMapper.selectByProductAndCode(release.getProductId(), DEFAULT_CHANNEL);
|
||||
if (channel != null && releaseId.equals(channel.getReleaseId())) {
|
||||
channelMapper.updateReleaseId(channel.getId(), null, operatorId, now);
|
||||
}
|
||||
log("APP_RELEASE_REVOKE", releaseId);
|
||||
}
|
||||
|
||||
/// 创建发布记录
|
||||
///
|
||||
/// @param release 发布记录
|
||||
/// @param operatorId 操作人用户 ID
|
||||
/// @return 创建后的记录
|
||||
public AppRelease create(AppRelease release, String operatorId) {
|
||||
AppRelease exists = releaseMapper.selectByVersion(release.getProductId(), release.getKind(), release.getVersionName());
|
||||
if (exists != null) {
|
||||
throw new IllegalArgumentException("版本已存在,不可重复使用版本号");
|
||||
}
|
||||
checkCompatibility(release);
|
||||
Long now = System.currentTimeMillis();
|
||||
release.setStatus(AppRelease.Status.DRAFT);
|
||||
release.setGrayPermille(release.getGrayPermille() == null ? 0 : release.getGrayPermille());
|
||||
release.setMandatory(Boolean.TRUE.equals(release.getMandatory()));
|
||||
release.setCreatedBy(operatorId);
|
||||
release.setCreatedAt(now);
|
||||
releaseMapper.insert(release);
|
||||
return release;
|
||||
}
|
||||
|
||||
/// 查询产品列表
|
||||
///
|
||||
/// @return 产品列表
|
||||
public List<AppProduct> listProducts() {
|
||||
return productMapper.selectAll();
|
||||
}
|
||||
|
||||
/// 保存产品
|
||||
///
|
||||
/// @param product 产品
|
||||
/// @return 保存后的产品
|
||||
public AppProduct saveProduct(AppProduct product) {
|
||||
Long now = System.currentTimeMillis();
|
||||
if (TimiJava.isEmpty(product.getId())) {
|
||||
product.setEnabled(product.getEnabled() == null || product.getEnabled());
|
||||
product.setCreatedAt(now);
|
||||
productMapper.insert(product);
|
||||
return product;
|
||||
}
|
||||
product.setUpdatedAt(now);
|
||||
productMapper.updateSelective(product);
|
||||
return productMapper.select(product.getId());
|
||||
}
|
||||
|
||||
/// 查询产品发布列表
|
||||
///
|
||||
/// @param productId 产品 ID
|
||||
/// @return 发布列表
|
||||
public List<AppRelease> listReleases(String productId) {
|
||||
return releaseMapper.selectByProduct(productId);
|
||||
}
|
||||
|
||||
/// 查询产品通道列表
|
||||
///
|
||||
/// @param productId 产品 ID
|
||||
/// @return 通道列表
|
||||
public List<AppChannel> listChannels(String productId) {
|
||||
return channelMapper.selectByProduct(productId);
|
||||
}
|
||||
|
||||
/// 删除草稿发布
|
||||
///
|
||||
/// 已发布的版本不允许删除,必须走撤回
|
||||
///
|
||||
/// @param releaseId 发布 ID
|
||||
/// @param operatorId 操作人用户 ID
|
||||
public void deleteRelease(String releaseId, String operatorId) {
|
||||
AppRelease release = releaseMapper.select(releaseId);
|
||||
if (release == null) {
|
||||
throw new IllegalArgumentException("发布记录不存在");
|
||||
}
|
||||
if (release.getStatus() == AppRelease.Status.PUBLISHED) {
|
||||
throw new IllegalArgumentException("已发布的版本不能删除,请先撤回");
|
||||
}
|
||||
releaseMapper.destroy(releaseId);
|
||||
log("APP_RELEASE_DELETE", releaseId);
|
||||
}
|
||||
|
||||
/// 删除通道
|
||||
///
|
||||
/// @param channelId 通道 ID
|
||||
/// @param operatorId 操作人用户 ID
|
||||
public void deleteChannel(String channelId, String operatorId) {
|
||||
AppChannel channel = channelMapper.select(channelId);
|
||||
if (channel == null) {
|
||||
throw new IllegalArgumentException("通道不存在");
|
||||
}
|
||||
if (DEFAULT_CHANNEL.equals(channel.getCode())) {
|
||||
throw new IllegalArgumentException("默认通道不能删除");
|
||||
}
|
||||
channelMapper.destroy(channelId);
|
||||
log("APP_CHANNEL_DELETE", channelId);
|
||||
}
|
||||
|
||||
/// 删除产品
|
||||
///
|
||||
/// 产品下仍有未删除的发布记录时拒绝删除,避免留下孤儿数据
|
||||
///
|
||||
/// @param productId 产品 ID
|
||||
/// @param operatorId 操作人用户 ID
|
||||
public void deleteProduct(String productId, String operatorId) {
|
||||
AppProduct product = productMapper.select(productId);
|
||||
if (product == null) {
|
||||
throw new IllegalArgumentException("产品不存在");
|
||||
}
|
||||
if (!releaseMapper.selectByProduct(productId).isEmpty()) {
|
||||
throw new IllegalArgumentException("产品下仍有发布记录,不能删除");
|
||||
}
|
||||
productMapper.destroy(productId);
|
||||
log("APP_PRODUCT_DELETE", productId);
|
||||
}
|
||||
|
||||
/// 校验兼容区间
|
||||
///
|
||||
/// @param release 发布记录
|
||||
private void checkCompatibility(AppRelease release) {
|
||||
if (release.getKind() != AppRelease.Kind.BUNDLE) {
|
||||
if (release.getVersionCode() == null) {
|
||||
throw new IllegalArgumentException("原生包必须指定 versionCode");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (release.getMinVersionCode() == null) {
|
||||
throw new IllegalArgumentException("热更包必须指定兼容的最低原生 versionCode");
|
||||
}
|
||||
if (release.getMaxVersionCode() != null && release.getMaxVersionCode() < release.getMinVersionCode()) {
|
||||
throw new IllegalArgumentException("兼容区间上限不能小于下限");
|
||||
}
|
||||
}
|
||||
|
||||
/// 写操作日志
|
||||
///
|
||||
/// @param action 操作标识
|
||||
/// @param result 操作对象
|
||||
private void log(String action, String result) {
|
||||
Logger logger = new Logger(Logger.Module.APP, Logger.Level.INFO, action);
|
||||
logger.setResult(result);
|
||||
loggerService.create(logger);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.imyeyu.api.modules.app.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
///
|
||||
/// 应用更新检查请求
|
||||
///
|
||||
/// 字段名遵循 Capgo 插件的上报协议,不可随意改名
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-11-06
|
||||
@Data
|
||||
public class AppUpdateCheckRequest {
|
||||
|
||||
/// 平台
|
||||
@JsonProperty("platform")
|
||||
protected String platform;
|
||||
|
||||
/// 设备标识,用于灰度分桶
|
||||
@JsonProperty("device_id")
|
||||
protected String deviceId;
|
||||
|
||||
/// 产品标识,取 Capacitor appId
|
||||
@JsonProperty("app_id")
|
||||
protected String appId;
|
||||
|
||||
/// 当前运行的 Web 包版本,内置包为 builtin
|
||||
@JsonProperty("version_name")
|
||||
protected String versionName;
|
||||
|
||||
/// 当前原生 versionCode
|
||||
@JsonProperty("version_code")
|
||||
protected String versionCode;
|
||||
|
||||
/// 当前原生版本名
|
||||
@JsonProperty("version_build")
|
||||
protected String versionBuild;
|
||||
|
||||
/// 插件版本
|
||||
@JsonProperty("plugin_version")
|
||||
protected String pluginVersion;
|
||||
|
||||
/// 系统版本
|
||||
@JsonProperty("version_os")
|
||||
protected String versionOs;
|
||||
|
||||
/// true 为模拟器
|
||||
@JsonProperty("is_emulator")
|
||||
protected Boolean emulator;
|
||||
|
||||
/// true 为生产包
|
||||
@JsonProperty("is_prod")
|
||||
protected Boolean prod;
|
||||
|
||||
/// 通道代码,为空时取 stable
|
||||
protected String channel;
|
||||
|
||||
/// 检查接口密钥
|
||||
protected String key;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.imyeyu.api.modules.app.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
///
|
||||
/// 应用更新检查响应
|
||||
///
|
||||
/// Capgo 插件要求 url 必须存在,无更新时回显当前版本号让插件跳过下载
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-11-06
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class AppUpdateCheckResponse {
|
||||
|
||||
/// 版本号
|
||||
protected String version;
|
||||
|
||||
/// 产物下载地址
|
||||
protected String url;
|
||||
|
||||
/// 产物 SHA-256
|
||||
protected String checksum;
|
||||
|
||||
/// 是否为强制更新
|
||||
protected Boolean mandatory;
|
||||
|
||||
/// 构建无更新响应,version 与当前一致时插件不会下载
|
||||
///
|
||||
/// @param currentVersion 当前运行的 Web 包版本
|
||||
/// @return 无更新响应
|
||||
public static AppUpdateCheckResponse none(String currentVersion) {
|
||||
return new AppUpdateCheckResponse(currentVersion, "", null, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.imyeyu.api.modules.common.bean;
|
||||
|
||||
/// Groovy 脚本执行结果
|
||||
///
|
||||
/// @param <T> 脚本返回值类型
|
||||
/// @author Codex
|
||||
/// @since 2026-09-04
|
||||
public record GroovyScriptExecutionResult<T>(String scriptId, String versionId, Integer version, String checksum, T result) {
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package com.imyeyu.api.modules.common.bean;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.Setting;
|
||||
import com.imyeyu.java.bean.timi.TimiCode;
|
||||
import com.imyeyu.java.bean.timi.TimiException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 设置模块
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-24 00:59
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum SettingModule {
|
||||
|
||||
COMMON(Setting.Module.Common.class),
|
||||
|
||||
DOMAIN(Setting.Module.Domain.class),
|
||||
|
||||
FOREVER_MC(Setting.Module.ForeverMC.class),
|
||||
|
||||
MULTILINGUAL(Setting.Module.Multilingual.class),
|
||||
|
||||
GITEA(Setting.Module.Gitea.class),
|
||||
|
||||
MUSIC(Setting.Module.Music.class),
|
||||
|
||||
JOURNAL(Setting.Module.Journal.class),
|
||||
|
||||
TEMP_FILE(Setting.Module.TempFile.class),
|
||||
|
||||
USER(Setting.Module.User.class),
|
||||
|
||||
SYSTEM(Setting.Module.System.class),
|
||||
|
||||
SYSTEM_STATUS(Setting.Module.SystemStatus.class);
|
||||
|
||||
/** 模块枚举类 */
|
||||
final Class<? extends Enum<?>> clazz;
|
||||
|
||||
public static <T extends Enum<?>> SettingModule fromClass(Class<T> clazz) {
|
||||
for (SettingModule value : values()) {
|
||||
if (value.clazz.equals(clazz)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
throw new TimiException(TimiCode.ERROR, "not found System Module: %s".formatted(clazz.getName()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.imyeyu.api.modules.common.bean;
|
||||
|
||||
import com.imyeyu.api.annotation.SettingBizType;
|
||||
import com.imyeyu.api.bean.SettingEnum;
|
||||
import com.imyeyu.api.modules.common.entity.Setting;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-24 14:47
|
||||
*/
|
||||
@Getter
|
||||
@SettingBizType("TEMP_FILE")
|
||||
@AllArgsConstructor
|
||||
public enum TempFileSetting implements SettingEnum {
|
||||
|
||||
/** 启用服务 */
|
||||
ENABLE(Boolean.TRUE.toString(), Setting.ValueType.BOOLEAN),
|
||||
|
||||
/** 最小缓存时长 */
|
||||
TTL_MIN("1h", Setting.ValueType.TIME),
|
||||
|
||||
/** 默认缓存时长 */
|
||||
TTL_DEFAULT("3d", Setting.ValueType.TIME),
|
||||
|
||||
/** 最大缓存时长 */
|
||||
TTL_MAX("7d", Setting.ValueType.TIME),
|
||||
|
||||
/** 已过期文件残留时长 */
|
||||
RESIDUE_TTL("90d", Setting.ValueType.TIME),
|
||||
|
||||
/** 每个 IP 限制有效临时文件容量 */
|
||||
LIMIT_SIZE_OF_IP("10 GB", Setting.ValueType.BYTE_SIZE);
|
||||
|
||||
final String defaultValue;
|
||||
|
||||
final Setting.ValueType valueType;
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.imyeyu.api.modules.common.bean.attachment;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author 夜雨
|
||||
* @since 2025-12-11 18:14
|
||||
*/
|
||||
public class Metadata {
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2025-12-11 18:15
|
||||
*/
|
||||
@Data
|
||||
public static class Image {
|
||||
|
||||
private int width;
|
||||
|
||||
private int height;
|
||||
}
|
||||
|
||||
/**
|
||||
* 缩略图
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-01-04 18:10
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ThumbImage extends Image {
|
||||
|
||||
private String sourceId;
|
||||
|
||||
private String sourceMongoId;
|
||||
|
||||
private String sourceMimeType;
|
||||
|
||||
/** 请求宽度(缓存键之一,null 表示未指定) */
|
||||
private Integer requestWidth;
|
||||
|
||||
/** 请求高度(缓存键之一,null 表示未指定) */
|
||||
private Integer requestHeight;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.imyeyu.api.modules.common.bean.attachment;
|
||||
|
||||
/// 缩略图缩放模式
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-21
|
||||
public enum ThumbnailFitMode {
|
||||
|
||||
/// 保持比例完整放入目标尺寸
|
||||
FIT,
|
||||
|
||||
/// 保持比例裁剪填满目标尺寸
|
||||
COVER,
|
||||
|
||||
/// 强制缩放到目标尺寸,可能导致图片变形
|
||||
STRETCH
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.imyeyu.api.modules.common.config;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/// 通知消息队列配置
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-20
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "notify.queue")
|
||||
public class NotifyQueueConfig {
|
||||
|
||||
private Mail mail = new Mail();
|
||||
|
||||
private Sms sms = new Sms();
|
||||
|
||||
private Wechat wechat = new Wechat();
|
||||
|
||||
private HTTP http = new HTTP();
|
||||
|
||||
/// 邮件队列配置
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class Mail extends Queue {
|
||||
|
||||
private String defaultFrom;
|
||||
}
|
||||
|
||||
/// 短信队列配置
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class Sms extends Queue {
|
||||
|
||||
private String appId;
|
||||
|
||||
private String sign;
|
||||
|
||||
private String secretId;
|
||||
|
||||
private String secretKey;
|
||||
|
||||
private Captcha captcha;
|
||||
|
||||
/// 短信验证码
|
||||
@Data
|
||||
public static class Captcha {
|
||||
|
||||
private String templateId;
|
||||
|
||||
private int ttlMinute;
|
||||
|
||||
private int argIndex;
|
||||
}
|
||||
}
|
||||
|
||||
/// 微信队列配置
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class Wechat extends Queue {
|
||||
}
|
||||
|
||||
/// HTTP 队列配置
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class HTTP extends Queue {
|
||||
}
|
||||
|
||||
/// 通用队列配置
|
||||
@Data
|
||||
public static class Queue {
|
||||
|
||||
/// true 为启用
|
||||
private boolean enable;
|
||||
|
||||
private String cron = "0/30 * * * * ?";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.imyeyu.api.modules.common.controller;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.imyeyu.api.annotation.RequireCorePermission;
|
||||
import com.imyeyu.api.bean.CorePermissionCode;
|
||||
import com.imyeyu.api.modules.common.entity.Article;
|
||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
||||
import com.imyeyu.api.modules.common.service.ArticleService;
|
||||
import com.imyeyu.api.modules.common.service.AttachmentService;
|
||||
import com.imyeyu.spring.annotation.AOPLog;
|
||||
import com.imyeyu.spring.annotation.RequestRateLimit;
|
||||
import com.imyeyu.spring.bean.Page;
|
||||
import com.imyeyu.spring.bean.PageResult;
|
||||
import com.imyeyu.spring.util.ResponseView;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/// 文章接口
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-09-09
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/article")
|
||||
public class ArticleController {
|
||||
|
||||
private final ArticleService service;
|
||||
private final AttachmentService attachmentService;
|
||||
|
||||
/// 查询文章列表
|
||||
///
|
||||
/// @param page 分页参数
|
||||
/// @return 文章分页
|
||||
@JsonView(ResponseView.Public.class)
|
||||
@RequestRateLimit
|
||||
@RequireCorePermission(CorePermissionCode.ARTICLE_READ)
|
||||
@PostMapping("/list")
|
||||
public PageResult<Article> list(@RequestBody Page<Article> page) {
|
||||
return service.page(page);
|
||||
}
|
||||
|
||||
/// 查询文章详情
|
||||
///
|
||||
/// @param id 文章 ID
|
||||
/// @return 文章详情
|
||||
@JsonView(ResponseView.Public.class)
|
||||
@RequestRateLimit
|
||||
@RequestMapping("/detail")
|
||||
public Article detail(@RequestParam String id) {
|
||||
Article article = service.get(id);
|
||||
article.setAttachmentList(attachmentService.listByBizId(Attachment.BizType.ARTICLE, article.getId()));
|
||||
return article;
|
||||
}
|
||||
|
||||
/// 创建文章
|
||||
///
|
||||
/// @param article 文章
|
||||
/// @return 创建后的文章
|
||||
@AOPLog
|
||||
@JsonView(ResponseView.Public.class)
|
||||
@RequestRateLimit
|
||||
@RequireCorePermission(CorePermissionCode.ARTICLE_CREATE)
|
||||
@PostMapping("/create")
|
||||
public Article create(@RequestBody Article article) {
|
||||
service.create(article);
|
||||
return article;
|
||||
}
|
||||
|
||||
/// 更新文章
|
||||
///
|
||||
/// @param article 文章
|
||||
@AOPLog
|
||||
@RequestRateLimit
|
||||
@RequireCorePermission(CorePermissionCode.ARTICLE_UPDATE)
|
||||
@PostMapping("/update")
|
||||
public void update(@RequestBody Article article) {
|
||||
service.update(article);
|
||||
}
|
||||
|
||||
/// 删除文章
|
||||
///
|
||||
/// @param id 文章 ID
|
||||
@AOPLog
|
||||
@RequestRateLimit
|
||||
@RequireCorePermission(CorePermissionCode.ARTICLE_DELETE)
|
||||
@PostMapping("/delete")
|
||||
public void delete(@RequestParam String id) {
|
||||
service.delete(id);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.imyeyu.api.modules.common.controller;
|
||||
|
||||
import com.imyeyu.api.modules.common.bean.attachment.ThumbnailFitMode;
|
||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
||||
import com.imyeyu.api.modules.common.service.AttachmentService;
|
||||
import com.imyeyu.api.modules.common.service.AttachmentVariantService;
|
||||
import com.imyeyu.api.modules.common.service.TempFileService;
|
||||
import com.imyeyu.api.modules.common.vo.attach.TempFileResp;
|
||||
import com.imyeyu.java.TimiJava;
|
||||
@@ -41,6 +43,7 @@ public class AttachmentController {
|
||||
|
||||
private final TempFileService tempFileService;
|
||||
private final AttachmentService service;
|
||||
private final AttachmentVariantService variantService;
|
||||
|
||||
/**
|
||||
* 查询附件详情
|
||||
@@ -65,6 +68,8 @@ public class AttachmentController {
|
||||
@PostMapping(value = "/create", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public Attachment create(Attachment attachment) {
|
||||
service.create(attachment);
|
||||
attachment.setFile(null);
|
||||
attachment.setInputStream(null);
|
||||
return attachment;
|
||||
}
|
||||
|
||||
@@ -184,14 +189,19 @@ public class AttachmentController {
|
||||
@AOPLog
|
||||
@IgnoreGlobalReturn
|
||||
@GetMapping({"/read/{id}", "/download/{id}"})
|
||||
public void readById(@PathVariable String id, @RequestParam(required = false) Integer thumbWidth, @RequestParam(required = false) Integer thumbHeight) throws UnsupportedEncodingException {
|
||||
public void readById(
|
||||
@PathVariable String id,
|
||||
@RequestParam(required = false) Integer thumbWidth,
|
||||
@RequestParam(required = false) Integer thumbHeight,
|
||||
@RequestParam(defaultValue = "FIT") ThumbnailFitMode fitMode
|
||||
) throws UnsupportedEncodingException {
|
||||
HttpServletResponse resp = TimiSpring.getResponse();
|
||||
Attachment attach = service.get(id);
|
||||
if (attach == null) {
|
||||
resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
responseAttachment(attach, thumbWidth, thumbHeight);
|
||||
responseAttachment(attach, thumbWidth, thumbHeight, fitMode);
|
||||
}
|
||||
|
||||
@AOPLog
|
||||
@@ -207,21 +217,31 @@ public class AttachmentController {
|
||||
public void read(@RequestParam String id) throws UnsupportedEncodingException {
|
||||
HttpServletResponse resp = TimiSpring.getResponse();
|
||||
Attachment attach = service.get(id);
|
||||
if (attach == null) {
|
||||
resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
if (TimiSpring.getRequest().getRequestURI().endsWith("/download")) {
|
||||
resp.setHeader("Content-Disposition", Network.getFileDownloadHeader(attach.getName()));
|
||||
}
|
||||
response(attach);
|
||||
response(attach, false);
|
||||
}
|
||||
|
||||
private void responseAttachment(Attachment attach, Integer thumbWidth, Integer thumbHeight) throws UnsupportedEncodingException {
|
||||
HttpServletResponse resp = TimiSpring.getResponse();
|
||||
if (attach != null && TimiSpring.getRequest().getRequestURI().endsWith("/download") && attach.getName() != null) {
|
||||
resp.setHeader("Content-Disposition", Network.getFileDownloadHeader(attach.getName()));
|
||||
}
|
||||
responseThumb(attach, thumbWidth, thumbHeight);
|
||||
private void responseAttachment(
|
||||
Attachment attach,
|
||||
Integer thumbWidth,
|
||||
Integer thumbHeight,
|
||||
ThumbnailFitMode fitMode
|
||||
) throws UnsupportedEncodingException {
|
||||
responseThumb(attach, thumbWidth, thumbHeight, fitMode);
|
||||
}
|
||||
|
||||
protected void responseThumb(Attachment attachment, Integer thumbWidth, Integer thumbHeight) {
|
||||
protected void responseThumb(
|
||||
Attachment attachment,
|
||||
Integer thumbWidth,
|
||||
Integer thumbHeight,
|
||||
ThumbnailFitMode fitMode
|
||||
) throws UnsupportedEncodingException {
|
||||
HttpServletResponse resp = TimiSpring.getResponse();
|
||||
if (TimiJava.isEmpty(attachment)) {
|
||||
resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||
@@ -229,21 +249,65 @@ public class AttachmentController {
|
||||
}
|
||||
if (thumbWidth == null && thumbHeight == null) {
|
||||
// 原图
|
||||
setDownloadHeader(attachment);
|
||||
response(attachment);
|
||||
return;
|
||||
}
|
||||
// 缩略图
|
||||
Attachment thumb = service.fetchThumb(attachment, thumbWidth, thumbHeight);
|
||||
response(TimiJava.defaultIfNull(thumb, attachment));
|
||||
Attachment thumb = variantService.fetchThumb(attachment, thumbWidth, thumbHeight, fitMode);
|
||||
setDownloadHeader(thumb);
|
||||
response(thumb);
|
||||
}
|
||||
|
||||
private void setDownloadHeader(Attachment attachment) throws UnsupportedEncodingException {
|
||||
if (attachment != null && TimiSpring.getRequest().getRequestURI().endsWith("/download") && attachment.getName() != null) {
|
||||
TimiSpring.getResponse().setHeader("Content-Disposition", Network.getFileDownloadHeader(attachment.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
/// 设置附件缓存头并处理条件请求
|
||||
///
|
||||
/// @param attachment 实际响应附件
|
||||
/// @return true 表示客户端缓存仍有效,已返回 304
|
||||
private boolean responseCache(Attachment attachment) {
|
||||
HttpServletResponse resp = TimiSpring.getResponse();
|
||||
resp.setHeader("Cache-Control", "private, no-cache");
|
||||
String md5 = attachment.getMd5();
|
||||
if (md5 == null || md5.isBlank()) {
|
||||
return false;
|
||||
}
|
||||
String etag = "\"%s\"".formatted(md5);
|
||||
resp.setHeader("ETag", etag);
|
||||
String ifNoneMatch = TimiSpring.getHeader("If-None-Match");
|
||||
if (ifNoneMatch == null) {
|
||||
return false;
|
||||
}
|
||||
for (String value : ifNoneMatch.split(",")) {
|
||||
String candidate = value.trim();
|
||||
if ("*".equals(candidate) || etag.equals(candidate) || ("W/" + etag).equals(candidate)) {
|
||||
resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void response(Attachment attachment) {
|
||||
response(attachment, true);
|
||||
}
|
||||
|
||||
private void response(Attachment attachment, boolean cacheable) {
|
||||
HttpServletResponse resp = TimiSpring.getResponse();
|
||||
try {
|
||||
if (TimiJava.isEmpty(attachment)) {
|
||||
resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
if (!cacheable) {
|
||||
resp.setHeader("Cache-Control", "private, no-store");
|
||||
} else if (responseCache(attachment)) {
|
||||
return;
|
||||
}
|
||||
resp.setContentType(attachment.getMimeType());
|
||||
attachment.doResponse();
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.imyeyu.api.modules.common.controller;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.imyeyu.api.annotation.RequireCorePermission;
|
||||
import com.imyeyu.api.bean.CorePermissionCode;
|
||||
import com.imyeyu.api.modules.common.entity.Feedback;
|
||||
import com.imyeyu.api.modules.common.service.FeedbackService;
|
||||
import com.imyeyu.api.modules.user.service.UserLoginService;
|
||||
import com.imyeyu.spring.TimiSpring;
|
||||
import com.imyeyu.spring.annotation.AOPLog;
|
||||
import com.imyeyu.spring.annotation.CaptchaValid;
|
||||
import com.imyeyu.spring.annotation.RequestRateLimit;
|
||||
import com.imyeyu.spring.bean.CaptchaData;
|
||||
import com.imyeyu.spring.bean.Page;
|
||||
import com.imyeyu.spring.bean.PageResult;
|
||||
import com.imyeyu.spring.util.ResponseView;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/// 通用反馈接口
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-08-19
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/feedback")
|
||||
public class FeedbackController {
|
||||
|
||||
private final FeedbackService service;
|
||||
private final UserLoginService userLoginService;
|
||||
|
||||
/// 提交反馈。登录用户和匿名用户均需提交图形验证码,匿名用户按 IP 限流
|
||||
///
|
||||
/// @param captchaData 带图形验证码的反馈请求
|
||||
@AOPLog
|
||||
@JsonView(ResponseView.Public.class)
|
||||
@CaptchaValid
|
||||
@RequestRateLimit(value = 3, inSeconds = 60)
|
||||
@PostMapping("/create")
|
||||
public void create(@RequestBody @Valid CaptchaData<Feedback> captchaData) {
|
||||
Feedback feedback = captchaData.getData();
|
||||
feedback.setIp(TimiSpring.getRequestIP());
|
||||
if (userLoginService.isLogged()) {
|
||||
feedback.setUserId(userLoginService.getRequireLoginUserId());
|
||||
}
|
||||
service.create(feedback);
|
||||
}
|
||||
|
||||
/// 查询反馈列表
|
||||
///
|
||||
/// @param page 分页参数
|
||||
/// @return 反馈分页
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
@RequestRateLimit
|
||||
@RequireCorePermission(CorePermissionCode.FEEDBACK_READ)
|
||||
@PostMapping("/list")
|
||||
public PageResult<Feedback> list(@RequestBody Page<Feedback> page) {
|
||||
return service.page(page);
|
||||
}
|
||||
|
||||
/// 查询反馈详情
|
||||
///
|
||||
/// @param id 反馈 ID
|
||||
/// @return 反馈详情
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
@RequestRateLimit
|
||||
@RequireCorePermission(CorePermissionCode.FEEDBACK_READ)
|
||||
@PostMapping("/detail")
|
||||
public Feedback detail(@RequestParam String id) {
|
||||
return service.get(id);
|
||||
}
|
||||
|
||||
/// 更新反馈
|
||||
///
|
||||
/// @param feedback 反馈
|
||||
@AOPLog
|
||||
@RequestRateLimit
|
||||
@RequireCorePermission(CorePermissionCode.FEEDBACK_UPDATE)
|
||||
@PostMapping("/update")
|
||||
public void update(@RequestBody Feedback feedback) {
|
||||
feedback.setRespondedBy(userLoginService.getRequireLoginUserId());
|
||||
service.update(feedback);
|
||||
}
|
||||
|
||||
/// 删除反馈
|
||||
///
|
||||
/// @param id 反馈 ID
|
||||
@AOPLog
|
||||
@RequestRateLimit
|
||||
@RequireCorePermission(CorePermissionCode.FEEDBACK_DELETE)
|
||||
@PostMapping("/delete")
|
||||
public void delete(@RequestParam String id) {
|
||||
service.delete(id);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.imyeyu.api.modules.common.controller;
|
||||
|
||||
import com.imyeyu.api.modules.common.vo.ClientLogRequest;
|
||||
import com.imyeyu.api.modules.system.entity.Logger;
|
||||
import com.imyeyu.api.modules.system.service.LoggerService;
|
||||
import com.imyeyu.spring.annotation.AOPLog;
|
||||
@@ -29,7 +30,9 @@ public class LoggerController {
|
||||
@AOPLog
|
||||
@RequiredToken
|
||||
@PostMapping("/create")
|
||||
public void create(@Valid @RequestBody Logger logger) {
|
||||
public void create(@Valid @RequestBody ClientLogRequest request) {
|
||||
Logger logger = Logger.info(Logger.Module.COMMON, "CLIENT_LOG");
|
||||
logger.setContent(request.getContent());
|
||||
service.create(logger);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
package com.imyeyu.api.modules.common.controller;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.imyeyu.api.annotation.RequireCorePermission;
|
||||
import com.imyeyu.api.bean.CorePermissionCode;
|
||||
import com.imyeyu.api.modules.common.entity.Notify;
|
||||
import com.imyeyu.api.modules.common.entity.NotifyDetail;
|
||||
import com.imyeyu.api.modules.common.service.NotifyDetailService;
|
||||
import com.imyeyu.api.modules.common.service.NotifyService;
|
||||
import com.imyeyu.api.modules.common.service.SmsService;
|
||||
import com.imyeyu.api.modules.common.vo.NotifyManagementItem;
|
||||
import com.imyeyu.api.modules.user.entity.User;
|
||||
import com.imyeyu.api.modules.user.service.UserLoginService;
|
||||
import com.imyeyu.api.modules.user.service.UserService;
|
||||
import com.imyeyu.java.TimiJava;
|
||||
import com.imyeyu.spring.annotation.AOPLog;
|
||||
import com.imyeyu.spring.annotation.CaptchaValid;
|
||||
import com.imyeyu.spring.annotation.RequestRateLimit;
|
||||
import com.imyeyu.spring.annotation.RequiredToken;
|
||||
import com.imyeyu.spring.bean.CaptchaData;
|
||||
import com.imyeyu.spring.bean.Page;
|
||||
import com.imyeyu.spring.bean.PageResult;
|
||||
import com.imyeyu.spring.util.ResponseView;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/// 通知接口
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-20
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/notify")
|
||||
public class NotifyController {
|
||||
|
||||
|
||||
private final SmsService smsService;
|
||||
private final UserService userService;
|
||||
private final NotifyService service;
|
||||
private final UserLoginService userLoginService;
|
||||
private final NotifyDetailService detailService;
|
||||
|
||||
/// 创建通知,同时创建通知详情
|
||||
///
|
||||
/// @param notify 通知及通知详情
|
||||
/// @return 创建后的通知
|
||||
@RequireCorePermission(CorePermissionCode.NOTIFY_CREATE)
|
||||
@RequiredToken
|
||||
@PostMapping("/create")
|
||||
public Notify create(@RequestBody Notify notify) {
|
||||
String sendFrom = userLoginService.isLogged() ? userLoginService.getRequireLoginUserId() : null;
|
||||
notify.setCreatedBy(sendFrom);
|
||||
for (NotifyDetail detail : notify.getDetailList()) {
|
||||
detail.setNotifyId(notify.getId());
|
||||
if (TimiJava.isNotEmpty(sendFrom)) {
|
||||
detail.setSendFrom(sendFrom);
|
||||
}
|
||||
}
|
||||
service.create(notify);
|
||||
return notify;
|
||||
}
|
||||
|
||||
/// 查询通知详情
|
||||
///
|
||||
/// @param id 通知 ID
|
||||
/// @return 通知及通知详情
|
||||
@JsonView(ResponseView.Public.class)
|
||||
@RequireCorePermission(CorePermissionCode.NOTIFY_READ)
|
||||
@RequiredToken
|
||||
@RequestMapping("/detail")
|
||||
public Notify detail(@RequestParam String id) {
|
||||
return fillDetailList(service.get(id));
|
||||
}
|
||||
|
||||
/// 查询管理端通知列表
|
||||
///
|
||||
/// @param page 分页参数
|
||||
/// @return 管理端通知列表
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
@RequireCorePermission(CorePermissionCode.NOTIFY_READ)
|
||||
@RequiredToken
|
||||
@PostMapping("/management/list")
|
||||
public PageResult<NotifyManagementItem> managementList(@RequestBody(required = false) Page<Notify> page) {
|
||||
return service.pageManagement(page, userLoginService.getRequireLoginUserId());
|
||||
}
|
||||
|
||||
/// 查询管理端通知详情及收件人
|
||||
///
|
||||
/// @param id 通知 ID
|
||||
/// @return 通知详情及收件人
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
@RequireCorePermission(CorePermissionCode.NOTIFY_READ)
|
||||
@RequiredToken
|
||||
@PostMapping("/management/detail")
|
||||
public Notify managementDetail(@RequestParam String id) {
|
||||
return fillDetailList(service.getManagement(id, userLoginService.getRequireLoginUserId()));
|
||||
}
|
||||
|
||||
/// 删除通知及其通知详情
|
||||
///
|
||||
/// @param id 通知 ID
|
||||
@RequireCorePermission(CorePermissionCode.NOTIFY_DELETE)
|
||||
@RequiredToken
|
||||
@PostMapping("/delete")
|
||||
public void delete(@RequestParam String id) {
|
||||
service.delete(id);
|
||||
}
|
||||
|
||||
/// 取消尚未成功发送的通知详情
|
||||
///
|
||||
/// @param id 通知 ID
|
||||
@RequireCorePermission(CorePermissionCode.NOTIFY_CANCEL)
|
||||
@RequiredToken
|
||||
@PostMapping("/cancel")
|
||||
public void cancel(@RequestParam String id) {
|
||||
service.cancel(id);
|
||||
}
|
||||
|
||||
/// 删除管理端通知及其通知详情
|
||||
///
|
||||
/// @param id 通知 ID
|
||||
@RequireCorePermission(CorePermissionCode.NOTIFY_DELETE)
|
||||
@RequiredToken
|
||||
@PostMapping("/management/delete")
|
||||
public void managementDelete(@RequestParam String id) {
|
||||
service.deleteManagement(id, userLoginService.getRequireLoginUserId());
|
||||
}
|
||||
|
||||
/// 取消管理端尚未成功发送的通知
|
||||
///
|
||||
/// @param id 通知 ID
|
||||
@RequireCorePermission(CorePermissionCode.NOTIFY_CANCEL)
|
||||
@RequiredToken
|
||||
@PostMapping("/management/cancel")
|
||||
public void managementCancel(@RequestParam String id) {
|
||||
service.cancelManagement(id, userLoginService.getRequireLoginUserId());
|
||||
}
|
||||
|
||||
@AOPLog
|
||||
@CaptchaValid
|
||||
@RequestRateLimit(value = 1, inSeconds = 59)
|
||||
@PostMapping("/sms/captcha/create")
|
||||
public String smsCaptchaCreate(@RequestBody CaptchaData<Notify> req) {
|
||||
return smsService.captchaCreate(req.getData());
|
||||
}
|
||||
|
||||
/// 查询当前用户的站内通知
|
||||
///
|
||||
/// @param page 分页参数
|
||||
/// @param unreadOnly true 为只查询未读通知
|
||||
/// @return 站内通知分页结果
|
||||
@RequireCorePermission(CorePermissionCode.NOTIFY_READ)
|
||||
@RequiredToken
|
||||
@PostMapping("/internal/internal")
|
||||
public PageResult<NotifyDetail> listInternal(
|
||||
@RequestBody(required = false) Page<NotifyDetail> page,
|
||||
@RequestParam(defaultValue = "false") boolean unreadOnly
|
||||
) {
|
||||
return detailService.pageInternalByUserId(page, userLoginService.getRequireLoginUserId(), unreadOnly);
|
||||
}
|
||||
|
||||
@JsonView(ResponseView.Public.class)
|
||||
@RequireCorePermission(CorePermissionCode.NOTIFY_READ)
|
||||
@RequiredToken
|
||||
@PostMapping("/internal/detail")
|
||||
public NotifyDetail internalDetail(@RequestParam String id) {
|
||||
NotifyDetail detail = detailService.getInternalByUserId(id, userLoginService.getRequireLoginUserId());
|
||||
if (TimiJava.isNotEmpty(detail.getSendFrom())) {
|
||||
detail.setFromUser(userService.get(detail.getSendFrom()));
|
||||
}
|
||||
if (TimiJava.isNotEmpty(detail.getSendTo())) {
|
||||
detail.setToUser(userService.get(detail.getSendTo()));
|
||||
}
|
||||
return detail;
|
||||
}
|
||||
|
||||
/// 隐藏当前用户的一条站内通知
|
||||
///
|
||||
/// @param id 通知详情 ID
|
||||
@RequireCorePermission(CorePermissionCode.NOTIFY_READ)
|
||||
@RequiredToken
|
||||
@PostMapping("/internal/delete")
|
||||
public void deleteInternal(@RequestParam String id) {
|
||||
detailService.hideInternalByUserId(id, userLoginService.getRequireLoginUserId());
|
||||
}
|
||||
|
||||
/// 查询当前用户未读通知数量
|
||||
///
|
||||
/// @return 未读通知数量
|
||||
@RequireCorePermission(CorePermissionCode.NOTIFY_READ)
|
||||
@RequiredToken
|
||||
@PostMapping("/internal/unread/count")
|
||||
public long countUnreadSite() {
|
||||
return detailService.countUnreadSiteByUserId(userLoginService.getRequireLoginUserId());
|
||||
}
|
||||
|
||||
/// 标记当前用户的一条站内通知已读
|
||||
///
|
||||
/// @param id 通知详情 ID
|
||||
@RequireCorePermission(CorePermissionCode.NOTIFY_READ)
|
||||
@RequiredToken
|
||||
@PostMapping("/internal/read")
|
||||
public void markSiteRead(@RequestParam String id) {
|
||||
detailService.markSiteRead(userLoginService.getRequireLoginUserId(), id);
|
||||
}
|
||||
|
||||
/// 标记当前用户全部站内通知已读
|
||||
@RequireCorePermission(CorePermissionCode.NOTIFY_READ)
|
||||
@RequiredToken
|
||||
@PostMapping("/internal/read/all")
|
||||
public void markAllSiteRead() {
|
||||
detailService.markAllSiteRead(userLoginService.getRequireLoginUserId());
|
||||
}
|
||||
|
||||
/// 回填通知详情中的用户信息
|
||||
///
|
||||
/// @param notify 通知
|
||||
/// @return 已回填用户信息的通知
|
||||
private Notify fillDetailList(Notify notify) {
|
||||
if (notify == null) {
|
||||
return null;
|
||||
}
|
||||
List<NotifyDetail> detailList = detailService.listByNotifyId(notify.getId());
|
||||
Set<String> userIdSet = detailList.stream()
|
||||
.filter(item -> item.getMsgType() == NotifyDetail.MsgType.INTERNAL)
|
||||
.flatMap(item -> Stream.of(item.getSendFrom(), item.getSendTo()))
|
||||
.collect(Collectors.toSet());
|
||||
Map<String, User> userMap = userService.mapByIdList(userIdSet);
|
||||
for (NotifyDetail detail : detailList) {
|
||||
if (TimiJava.isNotEmpty(detail.getSendFrom())) {
|
||||
detail.setFromUser(userMap.get(detail.getSendFrom()));
|
||||
}
|
||||
if (TimiJava.isNotEmpty(detail.getSendTo())) {
|
||||
detail.setToUser(userMap.get(detail.getSendTo()));
|
||||
}
|
||||
}
|
||||
notify.setDetailList(detailList);
|
||||
return notify;
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,12 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
@@ -26,11 +30,30 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/system/setting")
|
||||
@RequestMapping("/setting")
|
||||
public class SettingController {
|
||||
|
||||
private final SettingService service;
|
||||
|
||||
/**
|
||||
* 查询公开配置映射
|
||||
*
|
||||
* @param bizType 业务类型
|
||||
* @param bizId 业务 ID,可为空
|
||||
* @param code 配置代码列表,可为空
|
||||
* @return 公开配置映射
|
||||
*/
|
||||
@JsonView(ResponseView.Public.class)
|
||||
@RequestRateLimit
|
||||
@RequestMapping("/map")
|
||||
public Map<String, Setting> map(
|
||||
@RequestParam String bizType,
|
||||
@RequestParam(required = false) String bizId,
|
||||
@RequestParam(required = false) List<String> code
|
||||
) {
|
||||
return service.mapPublic(bizType, bizId, code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询配置列表
|
||||
*
|
||||
@@ -53,6 +76,7 @@ public class SettingController {
|
||||
*/
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
@RequestRateLimit
|
||||
@RequireCorePermission(CorePermissionCode.SETTING_READ)
|
||||
@PostMapping("/detail")
|
||||
public Setting detail(@RequestBody String id) {
|
||||
return service.get(id);
|
||||
@@ -66,6 +90,7 @@ public class SettingController {
|
||||
*/
|
||||
@AOPLog
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
@RequireCorePermission(CorePermissionCode.SETTING_CREATE)
|
||||
@RequestRateLimit
|
||||
@PostMapping("/create")
|
||||
public Setting create(@RequestBody Setting setting) {
|
||||
@@ -80,6 +105,7 @@ public class SettingController {
|
||||
*/
|
||||
@AOPLog
|
||||
@RequestRateLimit
|
||||
@RequireCorePermission(CorePermissionCode.SETTING_UPDATE)
|
||||
@PostMapping("/update")
|
||||
public void update(@RequestBody Setting setting) {
|
||||
service.update(setting);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.imyeyu.api.modules.common.entity;
|
||||
|
||||
import com.imyeyu.api.modules.common.bean.attachment.SettingSupport;
|
||||
import com.imyeyu.api.modules.user.entity.User;
|
||||
import com.imyeyu.spring.annotation.table.PageIgnore;
|
||||
import com.imyeyu.spring.annotation.table.Transient;
|
||||
import com.imyeyu.spring.entity.UUIDEntity;
|
||||
@@ -28,7 +29,17 @@ public class Article extends UUIDEntity implements SettingSupport {
|
||||
public enum BizType {
|
||||
|
||||
/** 博客 */
|
||||
BLOG
|
||||
BLOG,
|
||||
|
||||
/// GAO 门店日记
|
||||
GAO_STORE_DIARY,
|
||||
|
||||
GAO_HELP,
|
||||
|
||||
GAO_SYSTEM,
|
||||
|
||||
/// 反馈
|
||||
FEEDBACK
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,6 +60,19 @@ public class Article extends UUIDEntity implements SettingSupport {
|
||||
TIP_TAP
|
||||
}
|
||||
|
||||
/// 文章状态
|
||||
public enum Status {
|
||||
|
||||
/// 草稿
|
||||
DART,
|
||||
|
||||
/// 正常
|
||||
NORMAL,
|
||||
|
||||
/// 隐藏
|
||||
HIDDEN
|
||||
}
|
||||
|
||||
/** 业务类型 */
|
||||
protected BizType bizType;
|
||||
|
||||
@@ -58,8 +82,8 @@ public class Article extends UUIDEntity implements SettingSupport {
|
||||
/** 标题 */
|
||||
protected String title;
|
||||
|
||||
/** 摘要 */
|
||||
protected String digest;
|
||||
/** 描述 */
|
||||
protected String description;
|
||||
|
||||
/** 正文类型 */
|
||||
protected ContentType contentType;
|
||||
@@ -74,9 +98,21 @@ public class Article extends UUIDEntity implements SettingSupport {
|
||||
/** 喜欢数量 */
|
||||
protected Integer likes;
|
||||
|
||||
/** 文章状态 */
|
||||
protected Status status;
|
||||
|
||||
/// 最后更新用户 ID
|
||||
protected String updatedBy;
|
||||
|
||||
@Transient
|
||||
protected User updater;
|
||||
|
||||
@Transient
|
||||
protected List<Setting> settingList;
|
||||
|
||||
@Transient
|
||||
protected List<Comment> commentList;
|
||||
|
||||
@Transient
|
||||
protected List<Attachment> attachmentList;
|
||||
}
|
||||
|
||||
@@ -30,15 +30,45 @@ public class Attachment extends UUIDEntity {
|
||||
/// @since 2026-07-17 20:52
|
||||
public enum BizType {
|
||||
|
||||
ARTICLE,
|
||||
|
||||
NOTIFY_DETAIL,
|
||||
|
||||
USER,
|
||||
|
||||
GAO_CUSTOMER,
|
||||
|
||||
GAO_PRODUCT,
|
||||
|
||||
GAO_PRODUCT_SKU,
|
||||
|
||||
GAO_EVENT_RECORD,
|
||||
|
||||
GAO_FUND_RECORD,
|
||||
|
||||
GAO_STOCK_RECORD,
|
||||
|
||||
GAO_ORDER_FULFILLMENT,
|
||||
|
||||
GAO_SALES_ORDER,
|
||||
|
||||
GAO_POINT_REDEMPTION,
|
||||
|
||||
GAO_POINT_REDEMPTION_RETURN,
|
||||
|
||||
GAO_RECYCLE_EXCHANGE,
|
||||
|
||||
GAO_RECYCLE_EXCHANGE_REVOKE,
|
||||
|
||||
GAO_CUSTOMER_FOLLOW_UP_REMINDER,
|
||||
|
||||
GAO_DATA_EXPORT,
|
||||
|
||||
TEMP_FILE,
|
||||
|
||||
MIRROR
|
||||
MIRROR,
|
||||
|
||||
APP_RELEASE
|
||||
}
|
||||
|
||||
protected BizType bizType;
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.imyeyu.api.modules.common.entity;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.imyeyu.api.modules.common.bean.attachment.ThumbnailFitMode;
|
||||
import com.imyeyu.spring.annotation.table.AutoUUID;
|
||||
import com.imyeyu.spring.annotation.table.Id;
|
||||
import lombok.Data;
|
||||
|
||||
/// 附件缩略图变体记录
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-21
|
||||
@Data
|
||||
public class AttachmentVariant {
|
||||
|
||||
/// 变体 ID
|
||||
@Id
|
||||
@AutoUUID
|
||||
private String id;
|
||||
|
||||
/// 源附件 ID
|
||||
private String sourceAttachmentId;
|
||||
|
||||
/// 源文件版本,使用源 GridFS ID
|
||||
private String sourceMongoId;
|
||||
|
||||
/// 源文件摘要
|
||||
private String sourceMd5;
|
||||
|
||||
/// 请求宽度,0 表示未指定
|
||||
private int requestWidth;
|
||||
|
||||
/// 请求高度,0 表示未指定
|
||||
private int requestHeight;
|
||||
|
||||
/// 缩放模式
|
||||
private ThumbnailFitMode fitMode;
|
||||
|
||||
/// 输出格式
|
||||
private String outputFormat;
|
||||
|
||||
/// 缩略图算法版本
|
||||
private String algorithmVersion;
|
||||
|
||||
/// 缩略图 GridFS ID
|
||||
private String mongoId;
|
||||
|
||||
/// 缩略图名称
|
||||
private String name;
|
||||
|
||||
/// 缩略图 MIME 类型
|
||||
private String mimeType;
|
||||
|
||||
/// 缩略图元数据
|
||||
private ObjectNode metadata;
|
||||
|
||||
/// 缩略图大小
|
||||
private long size;
|
||||
|
||||
/// 缩略图摘要
|
||||
private String md5;
|
||||
|
||||
/// 创建时间
|
||||
private long createdAt;
|
||||
|
||||
/// 过期时间
|
||||
private long expireAt;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.imyeyu.api.modules.common.entity;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.imyeyu.spring.annotation.table.AutoUUID;
|
||||
import com.imyeyu.spring.annotation.table.Id;
|
||||
import com.imyeyu.spring.entity.Creatable;
|
||||
import com.imyeyu.spring.entity.Destroyable;
|
||||
import com.imyeyu.spring.entity.IDEntity;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/// 通知基础队列实体
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-20
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class BaseQueueEntity implements IDEntity<String>, Creatable, Destroyable {
|
||||
|
||||
/** 主键 */
|
||||
@Id
|
||||
@AutoUUID
|
||||
protected String id;
|
||||
|
||||
/** 所属通知详情 ID */
|
||||
protected String notifyDetailId;
|
||||
|
||||
/** 内容 */
|
||||
protected String content;
|
||||
|
||||
/** 参数 */
|
||||
protected JsonNode args;
|
||||
|
||||
/** 发送去向 */
|
||||
protected String sendTo;
|
||||
|
||||
/** 发送时间 */
|
||||
protected Long sendAt;
|
||||
|
||||
/** 剩余重试次数 */
|
||||
protected Integer retry;
|
||||
|
||||
/** 超时时间 */
|
||||
protected Long timeoutAt;
|
||||
|
||||
/** 创建时间 */
|
||||
protected Long createdAt;
|
||||
|
||||
/// 从通知详情创建队列实体
|
||||
///
|
||||
/// @param detail 通知详情
|
||||
public BaseQueueEntity(NotifyDetail detail) {
|
||||
notifyDetailId = detail.getId();
|
||||
content = detail.getContent();
|
||||
args = detail.getArgs();
|
||||
sendTo = detail.getSendTo();
|
||||
sendAt = detail.getSendAt();
|
||||
retry = detail.getRetry();
|
||||
timeoutAt = detail.getTimeoutAt();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.imyeyu.api.modules.common.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.imyeyu.api.bean.ModuleCode;
|
||||
import com.imyeyu.spring.annotation.table.Transient;
|
||||
import com.imyeyu.spring.entity.UUIDEntity;
|
||||
import com.imyeyu.spring.util.ResponseView;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/// 通用反馈
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-08-19
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class Feedback extends UUIDEntity {
|
||||
|
||||
/// 反馈处理状态
|
||||
public enum Status {
|
||||
|
||||
/// 待处理
|
||||
PENDING,
|
||||
|
||||
/// 已回复
|
||||
REPLIED,
|
||||
|
||||
/// 已关闭
|
||||
CLOSED
|
||||
}
|
||||
|
||||
/// 所属模块
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private ModuleCode module;
|
||||
|
||||
/// 提交用户 ID,匿名反馈为 null
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
private String userId;
|
||||
|
||||
/// 反馈内容文章 ID
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private String contentId;
|
||||
|
||||
/// 联系方式
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private String contact;
|
||||
|
||||
/// 提交 IP
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
private String ip;
|
||||
|
||||
/// 处理状态
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private Status status;
|
||||
|
||||
/// 管理员回复文章 ID
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private String responseId;
|
||||
|
||||
/// 回复用户 ID
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
private String respondedBy;
|
||||
|
||||
/// 回复时间
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private Long respondedAt;
|
||||
|
||||
/// 管理员回复文章
|
||||
@Transient
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private Article content;
|
||||
|
||||
/// 管理员回复文章
|
||||
@Transient
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private Article response;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.imyeyu.api.modules.common.entity;
|
||||
|
||||
import com.imyeyu.spring.annotation.table.Transient;
|
||||
import com.imyeyu.spring.entity.UUIDEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/// Groovy 脚本
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-09-04
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GroovyScript extends UUIDEntity {
|
||||
|
||||
///
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026/9/4 14:54
|
||||
public enum BizType {
|
||||
|
||||
/// GAO 积分规则
|
||||
GAO_POINT_RULE
|
||||
}
|
||||
|
||||
/// 业务归属
|
||||
private BizType bizType;
|
||||
|
||||
/// 业务内唯一代码
|
||||
private String code;
|
||||
|
||||
/// 名称
|
||||
private String name;
|
||||
|
||||
/// 说明
|
||||
private String description;
|
||||
|
||||
/// true 为允许执行已发布版本
|
||||
private Boolean enabled;
|
||||
|
||||
/// 当前发布版本 ID
|
||||
private String publishedVersionId;
|
||||
|
||||
@Transient
|
||||
private GroovyScriptVersion latest;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.imyeyu.api.modules.common.entity;
|
||||
|
||||
import com.imyeyu.spring.entity.UUIDEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/// Groovy 脚本版本
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-09-04
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GroovyScriptVersion extends UUIDEntity {
|
||||
|
||||
/// 脚本 ID
|
||||
private String scriptId;
|
||||
|
||||
/// 版本号
|
||||
private Integer version;
|
||||
|
||||
/// 脚本内容
|
||||
private String content;
|
||||
|
||||
/// 脚本内容 SHA-256
|
||||
private String checksum;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.imyeyu.api.modules.common.entity;
|
||||
|
||||
import com.imyeyu.spring.annotation.table.Table;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/// HTTP 回调队列
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-20
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("http_queue")
|
||||
public class HTTPQueue extends BaseQueueEntity {
|
||||
|
||||
/** HTTP 请求方法 */
|
||||
protected String method;
|
||||
|
||||
/// 从通知详情创建 HTTP 队列
|
||||
///
|
||||
/// @param detail 通知详情
|
||||
public HTTPQueue(NotifyDetail detail) {
|
||||
super(detail);
|
||||
method = "POST";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.imyeyu.api.modules.common.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/// 邮件发送队列
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-20
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MailQueue extends BaseQueueEntity {
|
||||
|
||||
/** 邮件标题 */
|
||||
protected String subject;
|
||||
|
||||
/** 邮件附件 */
|
||||
protected String attachments;
|
||||
|
||||
/** 发送来源 */
|
||||
protected String sendFrom;
|
||||
|
||||
/// 从通知详情创建邮件队列
|
||||
///
|
||||
/// @param detail 通知详情
|
||||
public MailQueue(NotifyDetail detail) {
|
||||
super(detail);
|
||||
subject = detail.getSubject();
|
||||
sendFrom = detail.getSendFrom();
|
||||
}
|
||||
|
||||
/// 邮件附件
|
||||
@Data
|
||||
public static class Attachment {
|
||||
|
||||
/** 附件类型 */
|
||||
private Type type;
|
||||
|
||||
/** 附件值 */
|
||||
private String value;
|
||||
|
||||
/// 附件来源类型
|
||||
public enum Type {
|
||||
|
||||
/** 系统附件 */
|
||||
E2INS_ATTACH,
|
||||
|
||||
/** URL 附件 */
|
||||
URL
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.imyeyu.api.modules.common.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.imyeyu.java.bean.Language;
|
||||
import com.imyeyu.spring.annotation.table.Column;
|
||||
import com.imyeyu.spring.entity.UUIDEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -15,6 +17,18 @@ public class Multilingual extends UUIDEntity {
|
||||
|
||||
protected String zhCN;
|
||||
|
||||
@Column("zh_cn_pinyin_full")
|
||||
@JsonIgnore
|
||||
protected String zhCNPinyinFull;
|
||||
|
||||
@Column("zh_cn_pinyin_initial")
|
||||
@JsonIgnore
|
||||
protected String zhCNPinyinInitial;
|
||||
|
||||
@Column("zh_cn_pinyin_mixed")
|
||||
@JsonIgnore
|
||||
protected String zhCNPinyinMixed;
|
||||
|
||||
protected String zhTW;
|
||||
|
||||
protected String enUS;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.imyeyu.api.modules.common.entity;
|
||||
|
||||
import com.imyeyu.spring.annotation.table.AutoUUID;
|
||||
import com.imyeyu.spring.annotation.table.Id;
|
||||
import com.imyeyu.spring.annotation.table.Transient;
|
||||
import com.imyeyu.spring.entity.UUIDEntity;
|
||||
import lombok.Data;
|
||||
@@ -19,19 +17,14 @@ import java.util.List;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class Notify extends UUIDEntity {
|
||||
|
||||
/** 主键 */
|
||||
@Id
|
||||
@AutoUUID
|
||||
private String id;
|
||||
|
||||
/** 业务类型 */
|
||||
private String bizType;
|
||||
|
||||
/** 提醒业务类型 */
|
||||
/** 业务提醒类型 */
|
||||
private String bizRemindedType;
|
||||
|
||||
/** 提醒业务 ID */
|
||||
private String bizRemindedId;
|
||||
/** 业务提醒查重键 */
|
||||
private String bizRemindedKey;
|
||||
|
||||
/** 参数 */
|
||||
private String args;
|
||||
|
||||
@@ -1,11 +1,24 @@
|
||||
package com.imyeyu.api.modules.common.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.imyeyu.api.TimiServerAPI;
|
||||
import com.imyeyu.api.modules.common.service.BaseQueueService;
|
||||
import com.imyeyu.api.modules.common.service.HTTPQueueService;
|
||||
import com.imyeyu.api.modules.common.service.MailQueueService;
|
||||
import com.imyeyu.api.modules.common.service.SmsQueueService;
|
||||
import com.imyeyu.api.modules.common.service.WechatQueueService;
|
||||
import com.imyeyu.api.modules.user.entity.User;
|
||||
import com.imyeyu.spring.annotation.table.Transient;
|
||||
import com.imyeyu.spring.entity.UUIDEntity;
|
||||
import com.imyeyu.spring.util.ResponseView;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通知详情
|
||||
*
|
||||
@@ -25,13 +38,32 @@ public class NotifyDetail extends UUIDEntity {
|
||||
@AllArgsConstructor
|
||||
public enum MsgType {
|
||||
|
||||
SMS,
|
||||
/** 站内通知,不进入外部消息队列 */
|
||||
INTERNAL(null),
|
||||
|
||||
MAIL,
|
||||
SMS(SmsQueueService.class),
|
||||
|
||||
HTTP,
|
||||
MAIL(MailQueueService.class),
|
||||
|
||||
WECHAT;
|
||||
HTTP(HTTPQueueService.class),
|
||||
|
||||
WECHAT(WechatQueueService.class);
|
||||
|
||||
private final Class<? extends BaseQueueService<?>> queueServiceClass;
|
||||
|
||||
/// 获取消息队列服务
|
||||
///
|
||||
/// @return 消息队列服务
|
||||
public BaseQueueService<?> getService() {
|
||||
return TimiServerAPI.applicationContext.getBean(queueServiceClass);
|
||||
}
|
||||
|
||||
/// 判断是否需要外部消息队列
|
||||
///
|
||||
/// @return true 为需要外部消息队列
|
||||
public boolean isQueue() {
|
||||
return queueServiceClass != null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,45 +85,94 @@ public class NotifyDetail extends UUIDEntity {
|
||||
FAIL
|
||||
}
|
||||
|
||||
/// 内容类型
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-24
|
||||
public enum ContentType {
|
||||
|
||||
/** 纯文本 */
|
||||
TEXT,
|
||||
|
||||
/** TipTap 富文本 */
|
||||
TIP_TAP
|
||||
}
|
||||
|
||||
/** 所属通知 ID */
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private String notifyId;
|
||||
|
||||
/** 消息类型 */
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private MsgType msgType;
|
||||
|
||||
/** 模板 ID */
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
private String templateId;
|
||||
|
||||
/** 标题 */
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private String subject;
|
||||
|
||||
/** 内容 */
|
||||
private String data;
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private String content;
|
||||
|
||||
/// 内容类型
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private ContentType contentType;
|
||||
|
||||
/** 参数 */
|
||||
private String args;
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private JsonNode args;
|
||||
|
||||
/** 发送来源 */
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private String sendFrom;
|
||||
|
||||
/** 发送去向 */
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private String sendTo;
|
||||
|
||||
/** 发送时间 */
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private Long sendAt;
|
||||
|
||||
/** 重试计数 */
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
private Integer retry;
|
||||
|
||||
/** 超时时间 */
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
private Long timeoutAt;
|
||||
|
||||
/** 结果描述 */
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
private String resultDesc;
|
||||
|
||||
/** 状态 */
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private Status status;
|
||||
|
||||
/** 已读时间,站内通知未读时为空 */
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private Long readAt;
|
||||
|
||||
/// 收件人隐藏时间,仅站内通知生效
|
||||
@JsonIgnore
|
||||
private Long hiddenAt;
|
||||
|
||||
@Transient
|
||||
protected Notify notify;
|
||||
|
||||
@Transient
|
||||
protected User fromUser;
|
||||
|
||||
@Transient
|
||||
protected User toUser;
|
||||
|
||||
/// 媒体附件列表
|
||||
@JsonView(ResponseView.Public.class)
|
||||
@Transient
|
||||
protected List<Attachment> attachmentList;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.imyeyu.api.TimiServerAPI;
|
||||
import com.imyeyu.api.modules.common.bean.SettingModule;
|
||||
import com.imyeyu.spring.annotation.table.Transient;
|
||||
import com.imyeyu.spring.entity.UUIDEntity;
|
||||
import com.imyeyu.spring.util.ResponseView;
|
||||
@@ -62,6 +61,9 @@ public class Setting extends UUIDEntity {
|
||||
/** 时间 */
|
||||
TIME,
|
||||
|
||||
/// 字节大小
|
||||
BYTE_SIZE,
|
||||
|
||||
/** 时长 */
|
||||
DURATION,
|
||||
|
||||
@@ -102,16 +104,6 @@ public class Setting extends UUIDEntity {
|
||||
@Transient
|
||||
private Enum<?> keyRaw;
|
||||
|
||||
public Setting(Enum<?> key) {
|
||||
setKeyRaw(key);
|
||||
}
|
||||
|
||||
public Setting(Enum<?> key, Object value, ValueType valueType) {
|
||||
setKeyRaw(key);
|
||||
this.value = value.toString();
|
||||
this.valueType = valueType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 以字符串形式返回配置值
|
||||
*
|
||||
@@ -221,298 +213,4 @@ public class Setting extends UUIDEntity {
|
||||
throw new IllegalArgumentException("setting value is not valid json: %s".formatted(value), e);
|
||||
}
|
||||
}
|
||||
|
||||
public void setKeyRaw(Enum<?> key) {
|
||||
this.keyRaw = key;
|
||||
this.bizType = SettingModule.fromClass(key.getClass()).toString();
|
||||
this.code = key.toString();
|
||||
}
|
||||
|
||||
public boolean is(Enum<?> key) {
|
||||
return SettingModule.fromClass(key.getClass()).toString().equals(bizType) && key.toString().equals(code);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-24 14:23
|
||||
*/
|
||||
public static final class Module {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-24 15:39
|
||||
*/
|
||||
public enum Common {
|
||||
|
||||
/** 微信收款码 */
|
||||
WECHAT_RECEIVE_QR_CODE
|
||||
}
|
||||
|
||||
/**
|
||||
* 域名
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-26 17:18
|
||||
*/
|
||||
public enum Domain {
|
||||
|
||||
ROOT,
|
||||
|
||||
API,
|
||||
|
||||
GIT,
|
||||
|
||||
BLOG,
|
||||
|
||||
SPACE,
|
||||
|
||||
FOREVER_MC
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-24 15:14
|
||||
*/
|
||||
public enum Blog {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-24 15:03
|
||||
*/
|
||||
public enum User {
|
||||
|
||||
/** 启用登录 */
|
||||
ENABLE_LOGIN,
|
||||
|
||||
/** 启用注册 */
|
||||
ENABLE_REGISTER,
|
||||
|
||||
/** 允许数据更新 */
|
||||
ENABLE_PROFILE_UPDATE,
|
||||
|
||||
/** 令牌有效期 */
|
||||
TOKEN_TTL
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-24 15:21
|
||||
*/
|
||||
public enum Comment {
|
||||
|
||||
/** 启用服务 */
|
||||
ENABLE
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-24 15:03
|
||||
*/
|
||||
public enum ICP {
|
||||
|
||||
IMYEYU_COM
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-24 15:01
|
||||
*/
|
||||
public enum ForeverMC {
|
||||
|
||||
PLAYER_BIND_MAX,
|
||||
|
||||
LOGIN_TOKEN_TTL
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-24 14:57
|
||||
*/
|
||||
public enum Multilingual {
|
||||
|
||||
/** 翻译 API */
|
||||
TRANSLATE_API,
|
||||
|
||||
/** 翻译 AppId */
|
||||
TRANSLATE_APP_ID,
|
||||
|
||||
/** 翻译密钥 */
|
||||
TRANSLATE_KEY,
|
||||
|
||||
/** 翻译计划任务表达式 */
|
||||
TRANSLATE_CORN,
|
||||
|
||||
/** 缓存时长 */
|
||||
CACHE_TTL
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-24 14:55
|
||||
*/
|
||||
public enum Gitea {
|
||||
|
||||
/** 接口地址 */
|
||||
API,
|
||||
|
||||
/** 关于页面所属文章 ID */
|
||||
ABOUT_ARTICLE_ID,
|
||||
|
||||
/** 仓库文件地址 */
|
||||
REPOSITORY_PATH
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-24 14:52
|
||||
*/
|
||||
public enum Music {
|
||||
|
||||
/** 启用服务 */
|
||||
ENABLE,
|
||||
|
||||
/** 通信消息最大帧长度 */
|
||||
MAX_FRAME_LENGTH,
|
||||
|
||||
/** 受控端 IP */
|
||||
PLAYER_IP,
|
||||
|
||||
/** 受控端端口 */
|
||||
PLAYER_PORT,
|
||||
|
||||
/** 控制端 IP */
|
||||
CONTROLLER_IP,
|
||||
|
||||
/** 控制端端口 */
|
||||
CONTROLLER_PORT,
|
||||
|
||||
/** 控制端入口地址 */
|
||||
CONTROLLER_URI,
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-24 14:49
|
||||
*/
|
||||
public enum Journal {
|
||||
|
||||
/** 启用服务 */
|
||||
ENABLE,
|
||||
|
||||
/** 审核中 */
|
||||
REVIEWING,
|
||||
|
||||
/** 访问密钥 */
|
||||
KEY,
|
||||
|
||||
/** 微信小程序 AppId */
|
||||
APP_ID,
|
||||
|
||||
/** 微信小程序 AppSecret */
|
||||
APP_SECRET,
|
||||
|
||||
/** 备忘录内容 */
|
||||
MEMO,
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-24 14:47
|
||||
*/
|
||||
public enum TempFile {
|
||||
|
||||
/** 启用服务 */
|
||||
ENABLE,
|
||||
|
||||
/** 最小缓存时长 */
|
||||
TTL_MIN,
|
||||
|
||||
/** 默认缓存时长 */
|
||||
TTL_DEFAULT,
|
||||
|
||||
/** 最大缓存时长 */
|
||||
TTL_MAX,
|
||||
|
||||
/** 已过期文件残留时长 */
|
||||
RESIDUE_TTL,
|
||||
|
||||
/** 每个 IP 限制有效临时文件容量 */
|
||||
LIMIT_SIZE_OF_IP
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-27 14:35
|
||||
*/
|
||||
public enum FileSync {
|
||||
|
||||
ENABLE,
|
||||
|
||||
CRON,
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-24 14:23
|
||||
*/
|
||||
public enum System {
|
||||
|
||||
/** 文件系统基准路径 */
|
||||
FILE_BASE_PATH,
|
||||
|
||||
/** 设置缓存时长 */
|
||||
SETTING_TTL,
|
||||
|
||||
/** 哀悼滤镜 */
|
||||
ENABLE_MOURN_FILTER,
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-04-24 14:23
|
||||
*/
|
||||
public enum SystemStatus {
|
||||
|
||||
/** 状态采集数据量 */
|
||||
LIMIT,
|
||||
|
||||
/** 状态采集网卡 */
|
||||
NETWORK_MAC,
|
||||
|
||||
/** 状态采集频率 */
|
||||
RATE,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.imyeyu.api.modules.common.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/// 短信发送队列
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-20
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SmsQueue extends BaseQueueEntity {
|
||||
|
||||
/** 短信模板 ID */
|
||||
protected String templateId;
|
||||
|
||||
/// 从通知详情创建短信队列
|
||||
///
|
||||
/// @param detail 通知详情
|
||||
public SmsQueue(NotifyDetail detail) {
|
||||
super(detail);
|
||||
templateId = detail.getTemplateId();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.imyeyu.api.modules.common.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.imyeyu.api.annotation.MultilingualField;
|
||||
import com.imyeyu.spring.annotation.table.Transient;
|
||||
import com.imyeyu.spring.entity.UUIDEntity;
|
||||
@@ -40,4 +41,9 @@ public class Tag extends UUIDEntity {
|
||||
/// 中文名称
|
||||
@Transient
|
||||
protected String zhCN;
|
||||
|
||||
/// 当前查询业务下的使用量
|
||||
@Transient
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
protected Long useCount;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.imyeyu.api.modules.common.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/// 微信消息发送队列
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-20
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WechatQueue extends BaseQueueEntity {
|
||||
|
||||
/// 从通知详情创建微信队列
|
||||
///
|
||||
/// @param detail 通知详情
|
||||
public WechatQueue(NotifyDetail detail) {
|
||||
super(detail);
|
||||
}
|
||||
}
|
||||
@@ -32,30 +32,12 @@ public interface AttachmentMapper extends BaseMapper<Attachment, String>, RawMap
|
||||
|
||||
List<Attachment> selectByBizId(Attachment.BizType bizType, String bizId, List<String> attachTypes, Page<Attachment> page);
|
||||
|
||||
List<Attachment> selectByBizIdList(Attachment.BizType bizType, Collection<String> bizIdList, List<String> attachTypes);
|
||||
List<Attachment> selectAllByBizIdList(Attachment.BizType bizType, Collection<String> bizIdList, List<String> attachTypes);
|
||||
|
||||
List<Attachment> selectImageByBizIdList(Attachment.BizType bizType, Collection<String> bizIdList, String attachType);
|
||||
|
||||
long countByBizId(Attachment.BizType bizType, String bizId, List<String> attachTypes);
|
||||
|
||||
/**
|
||||
* 按源附件 ID 与请求尺寸查询已缓存缩略图
|
||||
*
|
||||
* @param bizType 源附件业务类型
|
||||
* @param sourceId 源附件 ID
|
||||
* @param requestWidth 请求宽度,{@code null} 表示未指定
|
||||
* @param requestHeight 请求高度,{@code null} 表示未指定
|
||||
* @return 缩略图附件,不存在返回 {@code null}
|
||||
*/
|
||||
Attachment selectThumb(Attachment.BizType bizType, String sourceId, Integer requestWidth, Integer requestHeight);
|
||||
|
||||
/**
|
||||
* 查询源附件的所有未销毁缩略图(含已软删除)
|
||||
*
|
||||
* @param sourceId 源附件 ID
|
||||
* @return 缩略图列表
|
||||
*/
|
||||
@Select("SELECT * FROM attachment WHERE biz_id = #{sourceId} AND attach_type = 'THUMB' AND is_destroyed = FALSE")
|
||||
List<Attachment> selectThumbsBySourceId(String sourceId);
|
||||
|
||||
@Select("SELECT * FROM attachment WHERE `is_destroyed` = FALSE AND `destroy_at` < " + UNIX_TIME)
|
||||
List<Attachment> selectNeedDestroy();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.imyeyu.api.modules.common.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
||||
import com.imyeyu.api.modules.common.entity.AttachmentVariant;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/// 附件缩略图变体 Mapper
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-21
|
||||
public interface AttachmentVariantMapper {
|
||||
|
||||
/// 查询有效缩略图附件
|
||||
///
|
||||
/// @param sourceAttachmentId 源附件 ID
|
||||
/// @param sourceMongoId 源 GridFS ID
|
||||
/// @param requestWidth 请求宽度,0 表示未指定
|
||||
/// @param requestHeight 请求高度,0 表示未指定
|
||||
/// @param fitMode 缩放模式
|
||||
/// @param outputFormat 输出格式
|
||||
/// @param algorithmVersion 算法版本
|
||||
/// @param now 当前时间
|
||||
/// @return 缩略图附件
|
||||
Attachment selectValidAttachment(
|
||||
@Param("sourceAttachmentId") String sourceAttachmentId,
|
||||
@Param("sourceMongoId") String sourceMongoId,
|
||||
@Param("requestWidth") int requestWidth,
|
||||
@Param("requestHeight") int requestHeight,
|
||||
@Param("fitMode") String fitMode,
|
||||
@Param("outputFormat") String outputFormat,
|
||||
@Param("algorithmVersion") String algorithmVersion,
|
||||
@Param("now") long now
|
||||
);
|
||||
|
||||
/// 查询指定变体记录,不判断是否过期
|
||||
///
|
||||
/// @param sourceAttachmentId 源附件 ID
|
||||
/// @param sourceMongoId 源 GridFS ID
|
||||
/// @param requestWidth 请求宽度,0 表示未指定
|
||||
/// @param requestHeight 请求高度,0 表示未指定
|
||||
/// @param fitMode 缩放模式
|
||||
/// @param outputFormat 输出格式
|
||||
/// @param algorithmVersion 算法版本
|
||||
/// @return 变体记录
|
||||
AttachmentVariant selectByKey(
|
||||
@Param("sourceAttachmentId") String sourceAttachmentId,
|
||||
@Param("sourceMongoId") String sourceMongoId,
|
||||
@Param("requestWidth") int requestWidth,
|
||||
@Param("requestHeight") int requestHeight,
|
||||
@Param("fitMode") String fitMode,
|
||||
@Param("outputFormat") String outputFormat,
|
||||
@Param("algorithmVersion") String algorithmVersion
|
||||
);
|
||||
|
||||
/// 查询源附件的所有变体
|
||||
///
|
||||
/// @param sourceAttachmentId 源附件 ID
|
||||
/// @return 变体列表
|
||||
List<AttachmentVariant> selectBySourceAttachmentId(@Param("sourceAttachmentId") String sourceAttachmentId);
|
||||
|
||||
/// 查询已过期变体
|
||||
///
|
||||
/// @param now 当前时间
|
||||
/// @return 已过期变体列表
|
||||
List<AttachmentVariant> selectExpired(@Param("now") long now);
|
||||
|
||||
/// 新增变体
|
||||
///
|
||||
/// @param variant 变体
|
||||
void insert(AttachmentVariant variant);
|
||||
|
||||
/// 延长缩略图变体的过期时间
|
||||
///
|
||||
/// @param id 变体 ID
|
||||
/// @param now 当前时间
|
||||
/// @param expireAt 新的过期时间
|
||||
/// @return 更新记录数
|
||||
int updateExpireAt(@Param("id") String id, @Param("now") long now, @Param("expireAt") long expireAt);
|
||||
|
||||
/// 删除变体
|
||||
///
|
||||
/// @param id 变体 ID
|
||||
void delete(@Param("id") String id);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.imyeyu.api.modules.common.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.BaseQueueEntity;
|
||||
import com.imyeyu.api.modules.common.util.QueueSQLProvider;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.DeleteProvider;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.SelectProvider;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/// 通知队列基础 Mapper
|
||||
///
|
||||
/// @param <T> 队列实体类型
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-20
|
||||
public interface BaseQueueMapper<T extends BaseQueueEntity> extends BaseMapper<T, String> {
|
||||
|
||||
/** 查询已到发送时间的队列 */
|
||||
@SelectProvider(type = QueueSQLProvider.class, method = "listReadyQueue")
|
||||
List<T> listReadyQueue();
|
||||
|
||||
/** 根据通知详情 ID 物理删除队列 */
|
||||
@DeleteProvider(type = QueueSQLProvider.class, method = "destroyByNotifyDetailId")
|
||||
void destroyByNotifyDetailId(@Param("notifyDetailId") String notifyDetailId);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.imyeyu.api.modules.common.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.Feedback;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
|
||||
/// 通用反馈 Mapper
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-08-19
|
||||
public interface FeedbackMapper extends BaseMapper<Feedback, String> {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.imyeyu.api.modules.common.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.GroovyScript;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
|
||||
/// Groovy 脚本 Mapper
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-09-04
|
||||
public interface GroovyScriptMapper extends BaseMapper<GroovyScript, String> {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.imyeyu.api.modules.common.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.GroovyScriptVersion;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/// Groovy 脚本版本 Mapper
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-09-04
|
||||
public interface GroovyScriptVersionMapper extends BaseMapper<GroovyScriptVersion, String> {
|
||||
|
||||
@Select("SELECT * FROM `groovy_script_version` WHERE `script_id` = #{scriptId} " + NOT_DELETE + " ORDER BY `version` DESC " + LIMIT_1)
|
||||
GroovyScriptVersion selectLatest(String scriptId);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.imyeyu.api.modules.common.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.HTTPQueue;
|
||||
|
||||
/// HTTP 队列 Mapper
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-20
|
||||
public interface HTTPQueueMapper extends BaseQueueMapper<HTTPQueue> {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.imyeyu.api.modules.common.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.MailQueue;
|
||||
|
||||
/// 邮件队列 Mapper
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-20
|
||||
public interface MailQueueMapper extends BaseQueueMapper<MailQueue> {
|
||||
}
|
||||
@@ -2,6 +2,11 @@ package com.imyeyu.api.modules.common.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.NotifyDetail;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通知详情 Mapper
|
||||
@@ -10,4 +15,38 @@ import com.imyeyu.spring.mapper.BaseMapper;
|
||||
* @since 2026-05-13 14:46
|
||||
*/
|
||||
public interface NotifyDetailMapper extends BaseMapper<NotifyDetail, String> {
|
||||
|
||||
String NOT_HIDDEN = " AND `hidden_at` IS NULL";
|
||||
|
||||
/** 查询用户的站内通知 */
|
||||
@Select("SELECT * FROM `notify_detail` WHERE `msg_type` = 'INTERNAL' AND `send_to` = #{userId} AND `send_at` < " + UNIX_TIME + NOT_HIDDEN + NOT_DELETE + " ORDER BY `created_at` DESC LIMIT #{offset}, #{limit}")
|
||||
List<NotifyDetail> selectSiteByUserId(@Param("userId") String userId, @Param("offset") long offset, @Param("limit") long limit);
|
||||
|
||||
/** 查询用户的未读站内通知 */
|
||||
@Select("SELECT * FROM `notify_detail` WHERE `msg_type` = 'INTERNAL' AND `send_to` = #{userId} AND `send_at` < " + UNIX_TIME + " AND `read_at` IS NULL " + NOT_HIDDEN + NOT_DELETE + " ORDER BY `created_at` DESC LIMIT #{offset}, #{limit}")
|
||||
List<NotifyDetail> selectUnreadSiteByUserId(@Param("userId") String userId, @Param("offset") long offset, @Param("limit") long limit);
|
||||
|
||||
/** 统计用户的站内通知数量 */
|
||||
@Select("SELECT COUNT(*) FROM `notify_detail` WHERE `msg_type` = 'INTERNAL' AND `send_to` = #{userId} AND `send_at` < " + UNIX_TIME + NOT_HIDDEN + NOT_DELETE)
|
||||
long countSiteByUserId(@Param("userId") String userId);
|
||||
|
||||
/** 统计用户的未读站内通知数量 */
|
||||
@Select("SELECT COUNT(*) FROM `notify_detail` WHERE `msg_type` = 'INTERNAL' AND `send_to` = #{userId} AND `send_at` < " + UNIX_TIME + " AND `read_at` IS NULL " + NOT_HIDDEN + NOT_DELETE)
|
||||
long countUnreadSiteByUserId(@Param("userId") String userId);
|
||||
|
||||
/** 查询用户拥有的站内通知 */
|
||||
@Select("SELECT * FROM `notify_detail` WHERE `id` = #{detailId} AND `msg_type` = 'INTERNAL' AND `send_to` = #{userId} AND `send_at` < " + UNIX_TIME + NOT_HIDDEN + NOT_DELETE + " LIMIT 1")
|
||||
NotifyDetail selectSiteByIdAndUserId(@Param("detailId") String detailId, @Param("userId") String userId);
|
||||
|
||||
/** 隐藏用户的站内通知 */
|
||||
@Update("UPDATE `notify_detail` SET `hidden_at` = " + UNIX_TIME + ", `updated_at` = " + UNIX_TIME + " WHERE `id` = #{detailId} AND `msg_type` = 'INTERNAL' AND `send_to` = #{userId} AND `send_at` < " + UNIX_TIME + NOT_HIDDEN + NOT_DELETE)
|
||||
int hideSiteByIdAndUserId(@Param("detailId") String detailId, @Param("userId") String userId);
|
||||
|
||||
/** 标记站内通知已读 */
|
||||
@Update("UPDATE `notify_detail` SET `read_at` = #{readAt}, `updated_at` = " + UNIX_TIME + " WHERE `id` = #{detailId} AND `msg_type` = 'INTERNAL' AND `send_to` = #{userId} AND `send_at` < " + UNIX_TIME + " AND `read_at` IS NULL " + NOT_HIDDEN + NOT_DELETE)
|
||||
int markSiteRead(@Param("detailId") String detailId, @Param("userId") String userId, @Param("readAt") long readAt);
|
||||
|
||||
/** 标记用户全部站内通知已读 */
|
||||
@Update("UPDATE `notify_detail` SET `read_at` = #{readAt}, `updated_at` = " + UNIX_TIME + " WHERE `msg_type` = 'INTERNAL' AND `send_to` = #{userId} AND `send_at` < " + UNIX_TIME + " AND `read_at` IS NULL " + NOT_HIDDEN + NOT_DELETE)
|
||||
int markAllSiteRead(@Param("userId") String userId, @Param("readAt") long readAt);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package com.imyeyu.api.modules.common.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.Notify;
|
||||
import com.imyeyu.api.modules.common.vo.NotifyManagementItem;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通知 Mapper
|
||||
@@ -10,4 +14,38 @@ import com.imyeyu.spring.mapper.BaseMapper;
|
||||
* @since 2026-05-13 14:46
|
||||
*/
|
||||
public interface NotifyMapper extends BaseMapper<Notify, String> {
|
||||
|
||||
/// 原子创建业务提醒
|
||||
int insertIfAbsent(Notify notify);
|
||||
|
||||
/// 按业务查重键查询未删除通知
|
||||
///
|
||||
/// @param bizType 业务类型
|
||||
/// @param bizRemindedType 业务提醒类型
|
||||
/// @param bizRemindedKey 业务提醒查重键
|
||||
/// @return 通知
|
||||
Notify selectByBusinessKey(@Param("bizType") String bizType,
|
||||
@Param("bizRemindedType") String bizRemindedType,
|
||||
@Param("bizRemindedKey") String bizRemindedKey);
|
||||
|
||||
/// 分页查询管理端通知
|
||||
///
|
||||
/// @param userId 管理员用户 ID
|
||||
/// @param offset 分页偏移量
|
||||
/// @param limit 分页大小
|
||||
/// @return 通知列表
|
||||
List<NotifyManagementItem> selectManagementPage(@Param("userId") String userId, @Param("offset") long offset, @Param("limit") long limit);
|
||||
|
||||
/// 统计管理端通知数量
|
||||
///
|
||||
/// @param userId 管理员用户 ID
|
||||
/// @return 通知数量
|
||||
long countManagement(@Param("userId") String userId);
|
||||
|
||||
/// 查询管理员可管理的通知
|
||||
///
|
||||
/// @param notifyId 通知 ID
|
||||
/// @param userId 管理员用户 ID
|
||||
/// @return 通知
|
||||
Notify selectManagement(@Param("notifyId") String notifyId, @Param("userId") String userId);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.imyeyu.api.modules.common.mapper;
|
||||
import com.imyeyu.api.modules.common.entity.Setting;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统配置
|
||||
*
|
||||
@@ -10,4 +12,6 @@ import com.imyeyu.spring.mapper.BaseMapper;
|
||||
* @since 2021-07-20 22:26
|
||||
*/
|
||||
public interface SettingMapper extends BaseMapper<Setting, String> {
|
||||
|
||||
List<Setting> selectPublicByQuery(String bizType, String bizId, List<String> codeList);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.imyeyu.api.modules.common.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.SmsQueue;
|
||||
|
||||
/// 短信队列 Mapper
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-20
|
||||
public interface SmsQueueMapper extends BaseQueueMapper<SmsQueue> {
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.imyeyu.api.modules.common.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.Tag;
|
||||
import com.imyeyu.api.modules.common.entity.TagApply;
|
||||
import com.imyeyu.spring.bean.Page;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -15,5 +17,41 @@ public interface TagMapper extends BaseMapper<Tag, String> {
|
||||
|
||||
List<Tag> selectByIdList(Collection<String> idList);
|
||||
|
||||
/// 按归属和名称关键词查询标签总数
|
||||
///
|
||||
/// @param ownerType 归属类型
|
||||
/// @param ownerId 归属 ID
|
||||
/// @param keyword 名称关键词
|
||||
/// @return 标签总数
|
||||
long countByOwnerAndKeyword(@Param("ownerType") Tag.OwnerType ownerType, @Param("ownerId") String ownerId, @Param("keyword") String keyword);
|
||||
|
||||
/// 按归属和名称关键词分页查询标签
|
||||
///
|
||||
/// @param ownerType 归属类型
|
||||
/// @param ownerId 归属 ID
|
||||
/// @param keyword 名称关键词
|
||||
/// @param offset 分页偏移量
|
||||
/// @param limit 分页数量
|
||||
/// @return 标签列表
|
||||
List<Tag> selectByOwnerAndKeyword(@Param("ownerType") Tag.OwnerType ownerType, @Param("ownerId") String ownerId, @Param("keyword") String keyword, @Param("offset") long offset, @Param("limit") long limit);
|
||||
|
||||
/// 按归属和名称关键词分页查询标签,并统计指定业务的使用量
|
||||
///
|
||||
/// @param ownerType 归属类型
|
||||
/// @param ownerId 归属 ID
|
||||
/// @param keyword 名称关键词
|
||||
/// @param bizType 业务类型
|
||||
/// @param offset 分页偏移量
|
||||
/// @param limit 分页数量
|
||||
/// @return 标签列表
|
||||
List<Tag> selectByOwnerAndKeywordWithUseCount(@Param("page") Page<Tag> page, @Param("ownerType") Tag.OwnerType ownerType, @Param("ownerId") String ownerId, @Param("keyword") String keyword, @Param("bizType") TagApply.BizType bizType, @Param("offset") long offset, @Param("limit") long limit);
|
||||
|
||||
/// 查询指定标签在指定业务下的使用量
|
||||
///
|
||||
/// @param tagId 标签 ID
|
||||
/// @param bizType 业务类型
|
||||
/// @return 使用量
|
||||
long countUseByTagIdAndBizType(@Param("tagId") String tagId, @Param("bizType") TagApply.BizType bizType);
|
||||
|
||||
Tag selectByOwnerAndZhCN(@Param("ownerType") Tag.OwnerType ownerType, @Param("ownerId") String ownerId, @Param("zhCN") String zhCN);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.imyeyu.api.modules.common.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.WechatQueue;
|
||||
|
||||
/// 微信队列 Mapper
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-20
|
||||
public interface WechatQueueMapper extends BaseQueueMapper<WechatQueue> {
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.imyeyu.api.modules.common.service;
|
||||
import com.imyeyu.api.modules.common.entity.Article;
|
||||
import com.imyeyu.spring.service.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文章服务
|
||||
*
|
||||
@@ -10,4 +12,10 @@ import com.imyeyu.spring.service.BaseService;
|
||||
* @since 2021-02-23 21:33
|
||||
*/
|
||||
public interface ArticleService extends BaseService<Article, String> {
|
||||
|
||||
/// 按示例查询文章
|
||||
///
|
||||
/// @param example 查询示例
|
||||
/// @return 文章列表
|
||||
List<Article> listByExample(Article example);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,11 @@ import java.util.Map;
|
||||
*/
|
||||
public interface AttachmentService extends BaseService<Attachment, String> {
|
||||
|
||||
/// 在无 HTTP 请求上下文时创建系统生成的附件
|
||||
///
|
||||
/// @param attachment 待创建附件
|
||||
void createBySystem(Attachment attachment);
|
||||
|
||||
///
|
||||
/// 克隆附件,复制业务属性和文件内容并生成新的附件记录
|
||||
///
|
||||
@@ -25,18 +30,6 @@ public interface AttachmentService extends BaseService<Attachment, String> {
|
||||
/// @return 克隆后的附件
|
||||
Attachment clone(String id);
|
||||
|
||||
/**
|
||||
* 按需获取或创建缩略图附件。
|
||||
* <p>当附件为图片或视频时,若指定尺寸的缩略图已存在则直接返回缓存,
|
||||
* 否则生成并持久化后返回。不支持缩略图的附件类型返回 {@code null}。</p>
|
||||
*
|
||||
* @param source 源附件(必须已持久化,mimeType 已填充)
|
||||
* @param requestWidth 请求宽度,{@code null} 表示未指定
|
||||
* @param requestHeight 请求高度,{@code null} 表示未指定
|
||||
* @return 缩略图附件,不支持时返回 {@code null}
|
||||
*/
|
||||
Attachment fetchThumb(Attachment source, Integer requestWidth, Integer requestHeight);
|
||||
|
||||
Attachment getByBizId(Attachment.BizType bizType, String bizId);
|
||||
|
||||
Attachment getByAttachType(Attachment.BizType bizType, String bizId, String attachType);
|
||||
@@ -57,6 +50,12 @@ public interface AttachmentService extends BaseService<Attachment, String> {
|
||||
*/
|
||||
List<Attachment> listByBizId(Attachment.BizType bizType, String bizId, String... attachTypes);
|
||||
|
||||
default Map<String, Attachment> mapFirstImageByIdList(Attachment.BizType bizType, Collection<String> bizIdList) {
|
||||
return mapFirstImageByIdList(bizType, bizIdList, null);
|
||||
}
|
||||
|
||||
Map<String, Attachment> mapFirstImageByIdList(Attachment.BizType bizType, Collection<String> bizIdList, String attachType);
|
||||
|
||||
/**
|
||||
* 根据多个业务 ID 批量获取附件
|
||||
*
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.imyeyu.api.modules.common.service;
|
||||
|
||||
import com.imyeyu.api.modules.common.bean.attachment.ThumbnailFitMode;
|
||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
||||
|
||||
/// 附件缩略图变体服务
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-21
|
||||
public interface AttachmentVariantService {
|
||||
|
||||
/// 按需获取或创建缩略图附件
|
||||
///
|
||||
/// @param source 源附件
|
||||
/// @param requestWidth 请求宽度
|
||||
/// @param requestHeight 请求高度
|
||||
/// @param fitMode 缩放模式
|
||||
/// @return 缩略图附件
|
||||
Attachment fetchThumb(Attachment source, Integer requestWidth, Integer requestHeight, ThumbnailFitMode fitMode);
|
||||
|
||||
/// 删除源附件对应的全部缩略图变体
|
||||
///
|
||||
/// @param sourceAttachmentId 源附件 ID
|
||||
void deleteBySourceId(String sourceAttachmentId);
|
||||
|
||||
/// 清理已过期的缩略图变体
|
||||
void clearExpired();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.imyeyu.api.modules.common.service;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.BaseQueueEntity;
|
||||
import com.imyeyu.api.modules.common.entity.NotifyDetail;
|
||||
|
||||
/// 通知队列基础服务
|
||||
///
|
||||
/// @param <T> 队列实体类型
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-20
|
||||
public interface BaseQueueService<T extends BaseQueueEntity> {
|
||||
|
||||
/// 创建队列
|
||||
///
|
||||
/// @param detail 通知详情
|
||||
void createQueue(NotifyDetail detail);
|
||||
|
||||
/// 删除队列
|
||||
///
|
||||
/// @param detail 通知详情
|
||||
void destroyQueue(NotifyDetail detail);
|
||||
|
||||
/// 执行已到期队列
|
||||
void invokeQueue();
|
||||
|
||||
/// 发送队列消息
|
||||
///
|
||||
/// @param queue 队列
|
||||
void send(T queue);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.imyeyu.api.modules.common.service;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.Feedback;
|
||||
import com.imyeyu.spring.service.BaseService;
|
||||
|
||||
/// 通用反馈服务
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-08-19
|
||||
public interface FeedbackService extends BaseService<Feedback, String> {
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.imyeyu.api.modules.common.service;
|
||||
|
||||
import com.imyeyu.api.modules.common.bean.GroovyScriptExecutionResult;
|
||||
import com.imyeyu.api.modules.common.entity.GroovyScript;
|
||||
import com.imyeyu.api.modules.common.entity.GroovyScriptVersion;
|
||||
import com.imyeyu.spring.service.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/// Groovy 脚本服务
|
||||
///
|
||||
/// 脚本仅限可信管理员维护,不能作为不可信用户代码的执行环境
|
||||
///
|
||||
/// @author Codex
|
||||
/// @since 2026-09-04
|
||||
public interface GroovyScriptService extends BaseService<GroovyScript, String> {
|
||||
|
||||
/// 按业务归属查询脚本列表
|
||||
///
|
||||
/// @param bizType 业务归属
|
||||
/// @return 脚本列表
|
||||
List<GroovyScript> listByBizType(GroovyScript.BizType bizType);
|
||||
|
||||
/// 按业务归属和代码查询脚本
|
||||
///
|
||||
/// @param bizType 业务归属
|
||||
/// @param code 业务内唯一代码
|
||||
/// @return 脚本,不存在时返回 null
|
||||
GroovyScript getByCode(GroovyScript.BizType bizType, String code);
|
||||
|
||||
/// 设置脚本启用状态
|
||||
///
|
||||
/// @param id 脚本 ID
|
||||
/// @param enabled true 为允许执行已发布版本
|
||||
void setEnabled(String id, boolean enabled);
|
||||
|
||||
GroovyScriptVersion getLatestVersion(String scriptId);
|
||||
|
||||
/// 创建不可变的脚本版本
|
||||
///
|
||||
/// @param scriptId 脚本 ID
|
||||
/// @param content 脚本内容
|
||||
/// @return 新版本
|
||||
GroovyScriptVersion createVersion(String scriptId, String content);
|
||||
|
||||
/// 查询脚本的全部版本
|
||||
///
|
||||
/// @param scriptId 脚本 ID
|
||||
/// @return 按版本号升序的版本列表
|
||||
List<GroovyScriptVersion> listVersion(String scriptId);
|
||||
|
||||
/// 发布指定版本
|
||||
///
|
||||
/// @param scriptId 脚本 ID
|
||||
/// @param versionId 脚本版本 ID
|
||||
void publish(String scriptId, String versionId);
|
||||
|
||||
/// 取消当前发布版本
|
||||
///
|
||||
/// @param scriptId 脚本 ID
|
||||
void unpublish(String scriptId);
|
||||
|
||||
/// 执行已发布且启用的脚本
|
||||
///
|
||||
/// @param bizType 业务归属
|
||||
/// @param code 业务内唯一代码
|
||||
/// @param bindings 传给脚本的变量
|
||||
/// @return 脚本返回值
|
||||
Object execute(GroovyScript.BizType bizType, String code, Map<String, Object> bindings);
|
||||
|
||||
/// 执行已发布且启用的脚本并返回实际执行版本
|
||||
///
|
||||
/// @param bizType 业务归属
|
||||
/// @param code 业务内唯一代码
|
||||
/// @param bindings 传给脚本的变量
|
||||
/// @param resultType 返回值类型
|
||||
/// @param <T> 返回值类型
|
||||
/// @return 脚本执行结果
|
||||
<T> GroovyScriptExecutionResult<T> executePublished(GroovyScript.BizType bizType, String code, Map<String, Object> bindings, Class<T> resultType);
|
||||
|
||||
/// 按指定历史版本执行脚本
|
||||
///
|
||||
/// 用于按积分发生时的脚本版本复算,脚本当前是否发布或启用不影响执行;脚本返回 null 表示未命中,属合法结果
|
||||
///
|
||||
/// @param versionId 脚本版本 ID
|
||||
/// @param bindings 传给脚本的变量
|
||||
/// @param resultType 返回值类型
|
||||
/// @param <T> 返回值类型
|
||||
/// @return 脚本执行结果
|
||||
<T> GroovyScriptExecutionResult<T> executeVersion(String versionId, Map<String, Object> bindings, Class<T> resultType);
|
||||
|
||||
/// 执行已发布且启用的脚本并验证返回值类型
|
||||
///
|
||||
/// @param bizType 业务归属
|
||||
/// @param code 业务内唯一代码
|
||||
/// @param bindings 传给脚本的变量
|
||||
/// @param resultType 返回值类型
|
||||
/// @param <T> 返回值类型
|
||||
/// @return 脚本返回值
|
||||
<T> T execute(GroovyScript.BizType bizType, String code, Map<String, Object> bindings, Class<T> resultType);
|
||||
|
||||
/// 清除脚本的本地编译缓存
|
||||
///
|
||||
/// 多实例部署时,其他节点在收到脚本变更通知后调用此方法
|
||||
///
|
||||
/// @param scriptId 脚本 ID
|
||||
void invalidate(String scriptId);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.imyeyu.api.modules.common.service;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.HTTPQueue;
|
||||
|
||||
/// HTTP 队列服务
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-20
|
||||
public interface HTTPQueueService extends BaseQueueService<HTTPQueue> {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.imyeyu.api.modules.common.service;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.MailQueue;
|
||||
|
||||
/// 邮件队列服务
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-20
|
||||
public interface MailQueueService extends BaseQueueService<MailQueue> {
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.imyeyu.api.modules.common.service;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.NotifyDetail;
|
||||
import com.imyeyu.spring.bean.Page;
|
||||
import com.imyeyu.spring.bean.PageResult;
|
||||
import com.imyeyu.spring.service.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通知详情服务
|
||||
*
|
||||
@@ -10,4 +14,59 @@ import com.imyeyu.spring.service.BaseService;
|
||||
* @since 2026-05-13 14:46
|
||||
*/
|
||||
public interface NotifyDetailService extends BaseService<NotifyDetail, String> {
|
||||
|
||||
/// 查询通知下的全部详情
|
||||
///
|
||||
/// @param notifyId 通知 ID
|
||||
/// @return 通知详情列表
|
||||
List<NotifyDetail> listByNotifyId(String notifyId);
|
||||
|
||||
/// 重新将通知详情放入消息队列
|
||||
///
|
||||
/// @param detailId 通知详情 ID
|
||||
void requeue(String detailId);
|
||||
|
||||
/// 取消尚未生效的通知详情
|
||||
///
|
||||
/// @param detailId 通知详情 ID
|
||||
/// @param reason 取消原因
|
||||
void cancelPending(String detailId, String reason);
|
||||
|
||||
/// 分页查询用户的站内通知
|
||||
///
|
||||
/// @param page 分页参数
|
||||
/// @param userId 用户 ID
|
||||
/// @param unreadOnly true 为只查询未读通知
|
||||
/// @return 站内通知分页结果
|
||||
PageResult<NotifyDetail> pageInternalByUserId(Page<NotifyDetail> page, String userId, boolean unreadOnly);
|
||||
|
||||
/// 查询当前用户拥有的站内通知详情
|
||||
///
|
||||
/// @param detailId 通知详情 ID
|
||||
/// @param userId 用户 ID
|
||||
/// @return 通知详情
|
||||
NotifyDetail getInternalByUserId(String detailId, String userId);
|
||||
|
||||
/// 隐藏当前用户拥有的站内通知详情
|
||||
///
|
||||
/// @param detailId 通知详情 ID
|
||||
/// @param userId 用户 ID
|
||||
void hideInternalByUserId(String detailId, String userId);
|
||||
|
||||
/// 查询用户未读站内通知数量
|
||||
///
|
||||
/// @param userId 用户 ID
|
||||
/// @return 未读数量
|
||||
long countUnreadSiteByUserId(String userId);
|
||||
|
||||
/// 标记站内通知已读
|
||||
///
|
||||
/// @param userId 用户 ID
|
||||
/// @param detailId 通知详情 ID
|
||||
void markSiteRead(String userId, String detailId);
|
||||
|
||||
/// 标记用户全部站内通知已读
|
||||
///
|
||||
/// @param userId 用户 ID
|
||||
void markAllSiteRead(String userId);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.imyeyu.api.modules.common.service;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.Notify;
|
||||
import com.imyeyu.api.modules.common.vo.NotifyManagementItem;
|
||||
import com.imyeyu.spring.bean.Page;
|
||||
import com.imyeyu.spring.bean.PageResult;
|
||||
import com.imyeyu.spring.service.BaseService;
|
||||
|
||||
/**
|
||||
@@ -10,4 +13,48 @@ import com.imyeyu.spring.service.BaseService;
|
||||
* @since 2026-05-13 14:46
|
||||
*/
|
||||
public interface NotifyService extends BaseService<Notify, String> {
|
||||
|
||||
/// 原子创建业务提醒,重复查重键不会创建通知详情
|
||||
///
|
||||
/// @param notify 通知
|
||||
void createIfAbsent(Notify notify);
|
||||
|
||||
/// 按业务查重键查询未删除通知
|
||||
///
|
||||
/// @param bizType 业务类型
|
||||
/// @param bizRemindedType 业务提醒类型
|
||||
/// @param bizRemindedKey 业务提醒查重键
|
||||
/// @return 通知
|
||||
Notify getByBusinessKey(String bizType, String bizRemindedType, String bizRemindedKey);
|
||||
|
||||
/// 分页查询当前用户创建的通知
|
||||
///
|
||||
/// @param page 分页参数
|
||||
/// @param userId 用户 ID
|
||||
/// @return 管理端通知列表
|
||||
PageResult<NotifyManagementItem> pageManagement(Page<Notify> page, String userId);
|
||||
|
||||
/// 查询当前用户可管理的通知
|
||||
///
|
||||
/// @param notifyId 通知 ID
|
||||
/// @param userId 用户 ID
|
||||
/// @return 通知
|
||||
Notify getManagement(String notifyId, String userId);
|
||||
|
||||
/// 删除当前用户创建的通知
|
||||
///
|
||||
/// @param notifyId 通知 ID
|
||||
/// @param userId 用户 ID
|
||||
void deleteManagement(String notifyId, String userId);
|
||||
|
||||
/// 取消当前用户创建的通知
|
||||
///
|
||||
/// @param notifyId 通知 ID
|
||||
/// @param userId 用户 ID
|
||||
void cancelManagement(String notifyId, String userId);
|
||||
|
||||
/// 取消通知中尚未成功发送的通知详情
|
||||
///
|
||||
/// @param notifyId 通知 ID
|
||||
void cancel(String notifyId);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.imyeyu.api.modules.common.service;
|
||||
|
||||
import com.imyeyu.api.modules.common.bean.SettingModule;
|
||||
import com.imyeyu.api.bean.SettingEnum;
|
||||
import com.imyeyu.api.modules.common.bean.attachment.SettingSupport;
|
||||
import com.imyeyu.api.modules.common.entity.Setting;
|
||||
import com.imyeyu.java.TimiJava;
|
||||
import com.imyeyu.spring.service.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 配置服务
|
||||
@@ -18,12 +19,22 @@ public interface SettingService extends BaseService<Setting, String> {
|
||||
|
||||
Setting getByCode(String bizType, String bizId, String code);
|
||||
|
||||
default Setting getSystem(Enum<?> bizType) {
|
||||
return getByCode(SettingModule.fromClass(bizType.getClass()).name(), TimiJava.ZERO_UUID, bizType.toString());
|
||||
default Setting getSystem(SettingEnum setting) {
|
||||
return getByCode(setting.getBizType(), TimiJava.ZERO_UUID, setting.name());
|
||||
}
|
||||
|
||||
List<Setting> listByBizId(String bizType, String bizId);
|
||||
|
||||
/**
|
||||
* 查询公开配置映射
|
||||
*
|
||||
* @param bizType 业务类型
|
||||
* @param bizId 业务 ID,可为空
|
||||
* @param code 配置代码列表,可为空
|
||||
* @return 公开配置映射
|
||||
*/
|
||||
Map<String, Setting> mapPublic(String bizType, String bizId, List<String> code);
|
||||
|
||||
default List<Setting> listBySettingSupport(SettingSupport settingSupport) {
|
||||
String bizType = settingSupport.getClass().getSimpleName().toUpperCase();
|
||||
return listByBizId(bizType, settingSupport.getId());
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.imyeyu.api.modules.common.service;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.SmsQueue;
|
||||
|
||||
/// 短信队列服务
|
||||
///
|
||||
/// @author 夜雨
|
||||
/// @since 2026-08-20
|
||||
public interface SmsQueueService extends BaseQueueService<SmsQueue> {
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.imyeyu.api.modules.common.service;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.Notify;
|
||||
import com.imyeyu.api.modules.common.entity.NotifyDetail;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-05-14 12:12
|
||||
*/
|
||||
public interface SmsService {
|
||||
|
||||
/**
|
||||
* 创建短信验证码通知
|
||||
*
|
||||
* @param detail 通知
|
||||
* @return 通知详情 ID
|
||||
*/
|
||||
String captchaCreate(Notify detail);
|
||||
|
||||
/**
|
||||
* 校验短信验证码
|
||||
*
|
||||
* @param detailId 通知详情 ID
|
||||
* @param captcha 请求验证码
|
||||
* @return 通知详情
|
||||
*/
|
||||
NotifyDetail captchaVerify(String detailId, String captcha);
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package com.imyeyu.api.modules.common.service;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.Tag;
|
||||
import com.imyeyu.api.modules.common.entity.TagApply;
|
||||
import com.imyeyu.spring.bean.Page;
|
||||
import com.imyeyu.spring.bean.PageResult;
|
||||
import com.imyeyu.spring.service.BaseService;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -15,6 +17,32 @@ public interface TagService extends BaseService<Tag, String> {
|
||||
|
||||
List<Tag> listByIdList(Collection<String> idList);
|
||||
|
||||
/// 按归属和名称关键词分页查询标签
|
||||
///
|
||||
/// @param page 分页参数
|
||||
/// @param ownerType 归属类型
|
||||
/// @param ownerId 归属 ID
|
||||
/// @param keyword 名称关键词
|
||||
/// @return 标签分页
|
||||
PageResult<Tag> pageByOwnerAndKeyword(Page<Tag> page, Tag.OwnerType ownerType, String ownerId, String keyword);
|
||||
|
||||
/// 按归属和名称关键词分页查询标签,并按指定业务的使用量排序
|
||||
///
|
||||
/// @param page 分页参数
|
||||
/// @param ownerType 归属类型
|
||||
/// @param ownerId 归属 ID
|
||||
/// @param keyword 名称关键词
|
||||
/// @param bizType 业务类型
|
||||
/// @return 标签分页
|
||||
PageResult<Tag> pageByOwnerAndKeywordWithUseCount(Page<Tag> page, Tag.OwnerType ownerType, String ownerId, String keyword, TagApply.BizType bizType);
|
||||
|
||||
/// 查询指定标签在指定业务下的使用量
|
||||
///
|
||||
/// @param tagId 标签 ID
|
||||
/// @param bizType 业务类型
|
||||
/// @return 使用量
|
||||
long countUseByTagIdAndBizType(String tagId, TagApply.BizType bizType);
|
||||
|
||||
/// 按业务查询标签列表
|
||||
///
|
||||
/// @param bizType 业务类型
|
||||
@@ -28,4 +56,10 @@ public interface TagService extends BaseService<Tag, String> {
|
||||
/// @param bizId 业务 ID
|
||||
/// @param tagIdList 标签 ID 列表
|
||||
void apply(TagApply.BizType bizType, String bizId, List<String> tagIdList);
|
||||
|
||||
/// 删除指定归属下的全部标签
|
||||
///
|
||||
/// @param ownerType 归属类型
|
||||
/// @param ownerId 归属 ID
|
||||
void deleteByOwner(Tag.OwnerType ownerType, String ownerId);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user