leniu-dev 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/auto-test-generator.md +315 -0
- package/.claude/agents/bug-analyzer.md +103 -0
- package/.claude/agents/code-reviewer.md +122 -0
- package/.claude/agents/code-scanner.md +145 -0
- package/.claude/agents/image-reader.md +154 -0
- package/.claude/agents/loki-runner.md +80 -0
- package/.claude/agents/mysql-runner.md +81 -0
- package/.claude/agents/project-manager.md +159 -0
- package/.claude/agents/requirements-analyzer.md +175 -0
- package/.claude/agents/task-fetcher.md +75 -0
- package/.claude/audio/completed.wav +0 -0
- package/.claude/commands/add-todo.md +255 -0
- package/.claude/commands/auto-test.md +252 -0
- package/.claude/commands/check.md +210 -0
- package/.claude/commands/crud.md +454 -0
- package/.claude/commands/dev.md +532 -0
- package/.claude/commands/init-config.md +154 -0
- package/.claude/commands/init-docs.md +681 -0
- package/.claude/commands/next.md +281 -0
- package/.claude/commands/opsx-apply.md +147 -0
- package/.claude/commands/opsx-archive.md +105 -0
- package/.claude/commands/opsx-bulk-archive.md +237 -0
- package/.claude/commands/opsx-continue.md +109 -0
- package/.claude/commands/opsx-explore.md +281 -0
- package/.claude/commands/opsx-ff.md +92 -0
- package/.claude/commands/opsx-new.md +65 -0
- package/.claude/commands/opsx-onboard.md +397 -0
- package/.claude/commands/opsx-sync.md +129 -0
- package/.claude/commands/opsx-verify.md +159 -0
- package/.claude/commands/progress.md +264 -0
- package/.claude/commands/release.md +109 -0
- package/.claude/commands/start.md +199 -0
- package/.claude/commands/sync.md +307 -0
- package/.claude/commands/update-status.md +428 -0
- package/.claude/docs/Mixin/344/275/277/347/224/250/346/214/207/345/215/227.md +299 -0
- package/.claude/docs/README.md +167 -0
- package/.claude/docs//345/211/215/347/253/257/345/274/200/345/217/221/346/214/207/345/215/227.md +599 -0
- package/.claude/docs//345/220/216/347/253/257/345/274/200/345/217/221/346/214/207/345/215/227.md +726 -0
- package/.claude/docs//345/267/245/344/275/234/346/265/201/345/274/200/345/217/221/346/214/207/345/215/227.md +714 -0
- package/.claude/docs//345/267/245/345/205/267/347/261/273/344/275/277/347/224/250/346/214/207/345/215/227.md +463 -0
- package/.claude/docs//346/225/260/346/215/256/345/272/223/350/256/276/350/256/241/350/247/204/350/214/203.md +390 -0
- package/.claude/docs//346/226/260/345/212/237/350/203/275/345/274/200/345/217/221/346/265/201/347/250/213/350/247/204/350/214/203.md +688 -0
- package/.claude/docs//346/226/260/351/241/271/347/233/256/345/274/200/345/217/221/346/265/201/347/250/213.md +365 -0
- package/.claude/docs//346/241/206/346/236/266/350/257/264/346/230/216.md +393 -0
- package/.claude/docs//350/267/257/347/224/261/351/205/215/347/275/256/346/214/207/345/215/227.md +246 -0
- package/.claude/framework-config.json +73 -0
- package/.claude/hooks/lib/notify.js +310 -0
- package/.claude/hooks/pre-tool-use.js +117 -0
- package/.claude/hooks/skill-forced-eval.js +161 -0
- package/.claude/hooks/stop.js +55 -0
- package/.claude/notify-config.json +9 -0
- package/.claude/settings.json +57 -0
- package/.claude/skills/add-skill/SKILL.md +488 -0
- package/.claude/skills/analyze-requirements/SKILL.md +112 -0
- package/.claude/skills/api-development/SKILL.md +315 -0
- package/.claude/skills/architecture-design/SKILL.md +152 -0
- package/.claude/skills/auto-test/SKILL.md +625 -0
- package/.claude/skills/auto-test/references/api-conventions.md +260 -0
- package/.claude/skills/backend-annotations/SKILL.md +248 -0
- package/.claude/skills/banana-image/CHANGELOG.md +37 -0
- package/.claude/skills/banana-image/README.md +146 -0
- package/.claude/skills/banana-image/SKILL.md +171 -0
- package/.claude/skills/banana-image/assets/logo.png +0 -0
- package/.claude/skills/banana-image/references/advanced-usage.md +189 -0
- package/.claude/skills/banana-image/scripts/apply_template.py +125 -0
- package/.claude/skills/banana-image/scripts/banana_image_exec.ts +412 -0
- package/.claude/skills/banana-image/scripts/batch_prep.py +82 -0
- package/.claude/skills/banana-image/scripts/package-lock.json +1437 -0
- package/.claude/skills/banana-image/scripts/package.json +18 -0
- package/.claude/skills/banana-image/scripts/requirements.txt +10 -0
- package/.claude/skills/banana-image/templates/poster.json +22 -0
- package/.claude/skills/banana-image/templates/product.json +17 -0
- package/.claude/skills/banana-image/templates/social.json +22 -0
- package/.claude/skills/banana-image/templates/thumbnail.json +17 -0
- package/.claude/skills/brainstorm/SKILL.md +216 -0
- package/.claude/skills/bug-detective/SKILL.md +295 -0
- package/.claude/skills/bug-detective/references/error-patterns.md +242 -0
- package/.claude/skills/chrome-cdp/SKILL.md +81 -0
- package/.claude/skills/chrome-cdp/scripts/cdp.mjs +838 -0
- package/.claude/skills/chrome-cdp/scripts/run-cdp.sh +7 -0
- package/.claude/skills/code-patterns/SKILL.md +163 -0
- package/.claude/skills/code-patterns/references/leniu-code-patterns.md +87 -0
- package/.claude/skills/codex-code-review/SKILL.md +327 -0
- package/.claude/skills/collaborating-with-codex/SKILL.md +180 -0
- package/.claude/skills/collaborating-with-codex/scripts/codex_bridge.py +275 -0
- package/.claude/skills/collaborating-with-gemini/SKILL.md +194 -0
- package/.claude/skills/collaborating-with-gemini/scripts/gemini_bridge.py +275 -0
- package/.claude/skills/crud-development/SKILL.md +328 -0
- package/.claude/skills/data-permission/SKILL.md +221 -0
- package/.claude/skills/data-permission/references/custom-data-scope.md +90 -0
- package/.claude/skills/database-ops/SKILL.md +210 -0
- package/.claude/skills/error-handler/SKILL.md +310 -0
- package/.claude/skills/file-oss-management/SKILL.md +260 -0
- package/.claude/skills/file-oss-management/references/entities.md +105 -0
- package/.claude/skills/file-oss-management/references/service-impl.md +104 -0
- package/.claude/skills/fix-bug/SKILL.md +269 -0
- package/.claude/skills/git-workflow/SKILL.md +179 -0
- package/.claude/skills/jenkins-deploy/SKILL.md +134 -0
- package/.claude/skills/jenkins-deploy/assets/env_param.template.json +51 -0
- package/.claude/skills/jenkins-deploy/assets/jk_build.py +400 -0
- package/.claude/skills/json-serialization/SKILL.md +341 -0
- package/.claude/skills/lanhu-design/SKILL.md +99 -0
- package/.claude/skills/leniu-api-development/SKILL.md +319 -0
- package/.claude/skills/leniu-api-development/references/real-examples.md +273 -0
- package/.claude/skills/leniu-architecture-design/SKILL.md +383 -0
- package/.claude/skills/leniu-backend-annotations/SKILL.md +277 -0
- package/.claude/skills/leniu-brainstorm/SKILL.md +242 -0
- package/.claude/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
- package/.claude/skills/leniu-code-patterns/SKILL.md +411 -0
- package/.claude/skills/leniu-crud-development/SKILL.md +404 -0
- package/.claude/skills/leniu-crud-development/references/templates.md +597 -0
- package/.claude/skills/leniu-customization-location/SKILL.md +410 -0
- package/.claude/skills/leniu-data-permission/SKILL.md +341 -0
- package/.claude/skills/leniu-database-ops/SKILL.md +426 -0
- package/.claude/skills/leniu-error-handler/SKILL.md +462 -0
- package/.claude/skills/leniu-java-concurrent/SKILL.md +400 -0
- package/.claude/skills/leniu-java-entity/SKILL.md +237 -0
- package/.claude/skills/leniu-java-entity/references/templates.md +237 -0
- package/.claude/skills/leniu-java-logging/SKILL.md +229 -0
- package/.claude/skills/leniu-java-logging/references/data-mask.md +46 -0
- package/.claude/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
- package/.claude/skills/leniu-java-mq/SKILL.md +338 -0
- package/.claude/skills/leniu-java-mybatis/SKILL.md +267 -0
- package/.claude/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
- package/.claude/skills/leniu-java-task/SKILL.md +367 -0
- package/.claude/skills/leniu-marketing-scenario/SKILL.md +448 -0
- package/.claude/skills/leniu-marketing-scenario/references/pay-meal-rules.md +197 -0
- package/.claude/skills/leniu-marketing-scenario/references/price-rules.md +286 -0
- package/.claude/skills/leniu-marketing-scenario/references/recharge-rules.md +188 -0
- package/.claude/skills/leniu-redis-cache/SKILL.md +331 -0
- package/.claude/skills/leniu-report-scenario/SKILL.md +508 -0
- package/.claude/skills/leniu-report-scenario/references/amount-handling.md +448 -0
- package/.claude/skills/leniu-report-scenario/references/analysis-module.md +64 -0
- package/.claude/skills/leniu-report-scenario/references/customization-table-fields.md +93 -0
- package/.claude/skills/leniu-report-scenario/references/customization.md +356 -0
- package/.claude/skills/leniu-report-scenario/references/data-permission.md +182 -0
- package/.claude/skills/leniu-report-scenario/references/export.md +553 -0
- package/.claude/skills/leniu-report-scenario/references/mealtime.md +197 -0
- package/.claude/skills/leniu-report-scenario/references/query-param.md +274 -0
- package/.claude/skills/leniu-report-scenario/references/report-tables.md +162 -0
- package/.claude/skills/leniu-report-scenario/references/standard-customization.md +112 -0
- package/.claude/skills/leniu-report-scenario/references/standard-table-fields.md +113 -0
- package/.claude/skills/leniu-report-scenario/references/total-line.md +179 -0
- package/.claude/skills/leniu-security-guard/SKILL.md +306 -0
- package/.claude/skills/leniu-utils-toolkit/SKILL.md +380 -0
- package/.claude/skills/loki-log-query/SKILL.md +430 -0
- package/.claude/skills/mysql-debug/SKILL.md +406 -0
- package/.claude/skills/performance-doctor/SKILL.md +297 -0
- package/.claude/skills/project-navigator/SKILL.md +211 -0
- package/.claude/skills/redis-cache/SKILL.md +282 -0
- package/.claude/skills/redis-cache/references/listeners.md +23 -0
- package/.claude/skills/scheduled-jobs/SKILL.md +277 -0
- package/.claude/skills/security-guard/SKILL.md +245 -0
- package/.claude/skills/security-guard/references/encrypt-config.md +103 -0
- package/.claude/skills/security-guard/references/sensitive-strategies.md +42 -0
- package/.claude/skills/sms-mail/SKILL.md +346 -0
- package/.claude/skills/sms-mail/references/mail-config.md +88 -0
- package/.claude/skills/sms-mail/references/sms-config.md +74 -0
- package/.claude/skills/social-login/SKILL.md +328 -0
- package/.claude/skills/social-login/references/provider-configs.md +118 -0
- package/.claude/skills/store-pc/SKILL.md +366 -0
- package/.claude/skills/sync-back-merge/SKILL.md +66 -0
- package/.claude/skills/task-tracker/SKILL.md +307 -0
- package/.claude/skills/tech-decision/SKILL.md +393 -0
- package/.claude/skills/tenant-management/SKILL.md +272 -0
- package/.claude/skills/tenant-management/references/tenant-scenarios.md +91 -0
- package/.claude/skills/test-development/SKILL.md +301 -0
- package/.claude/skills/test-development/references/parameterized-examples.md +119 -0
- package/.claude/skills/ui-pc/SKILL.md +438 -0
- package/.claude/skills/utils-toolkit/SKILL.md +354 -0
- package/.claude/skills/utils-toolkit/references/redis-utils-api.md +56 -0
- package/.claude/skills/websocket-sse/SKILL.md +350 -0
- package/.claude/skills/workflow-engine/SKILL.md +249 -0
- package/.claude/skills/yunxiao-task-management/SKILL.md +401 -0
- package/.claude/skills/yunxiao-task-management/templates//346/217/220/346/265/213/345/215/225/346/250/241/346/235/277.html +17 -0
- package/.claude/templates/env-config.md +27 -0
- package/.claude/templates//345/276/205/345/212/236/346/270/205/345/215/225/346/250/241/346/235/277.md +56 -0
- package/.claude/templates//351/234/200/346/261/202/346/226/207/346/241/243/346/250/241/346/235/277.md +85 -0
- package/.claude/templates//351/241/271/347/233/256/347/212/266/346/200/201/346/250/241/346/235/277.md +43 -0
- package/.codex/skills/add-skill/SKILL.md +488 -0
- package/.codex/skills/add-todo/SKILL.md +269 -0
- package/.codex/skills/analyze-requirements/SKILL.md +112 -0
- package/.codex/skills/api-development/SKILL.md +315 -0
- package/.codex/skills/architecture-design/SKILL.md +152 -0
- package/.codex/skills/auto-test/SKILL.md +453 -0
- package/.codex/skills/auto-test/references/api-conventions.md +260 -0
- package/.codex/skills/backend-annotations/SKILL.md +248 -0
- package/.codex/skills/banana-image/CHANGELOG.md +37 -0
- package/.codex/skills/banana-image/README.md +146 -0
- package/.codex/skills/banana-image/SKILL.md +171 -0
- package/.codex/skills/banana-image/assets/logo.png +0 -0
- package/.codex/skills/banana-image/references/advanced-usage.md +189 -0
- package/.codex/skills/banana-image/scripts/apply_template.py +125 -0
- package/.codex/skills/banana-image/scripts/banana_image_exec.ts +412 -0
- package/.codex/skills/banana-image/scripts/batch_prep.py +82 -0
- package/.codex/skills/banana-image/scripts/package-lock.json +1437 -0
- package/.codex/skills/banana-image/scripts/package.json +18 -0
- package/.codex/skills/banana-image/scripts/requirements.txt +10 -0
- package/.codex/skills/banana-image/templates/poster.json +22 -0
- package/.codex/skills/banana-image/templates/product.json +17 -0
- package/.codex/skills/banana-image/templates/social.json +22 -0
- package/.codex/skills/banana-image/templates/thumbnail.json +17 -0
- package/.codex/skills/brainstorm/SKILL.md +216 -0
- package/.codex/skills/bug-detective/SKILL.md +295 -0
- package/.codex/skills/bug-detective/references/error-patterns.md +242 -0
- package/.codex/skills/check/SKILL.md +367 -0
- package/.codex/skills/code-patterns/SKILL.md +163 -0
- package/.codex/skills/code-patterns/references/leniu-code-patterns.md +87 -0
- package/.codex/skills/collaborating-with-codex/SKILL.md +180 -0
- package/.codex/skills/collaborating-with-codex/scripts/codex_bridge.py +275 -0
- package/.codex/skills/collaborating-with-gemini/SKILL.md +194 -0
- package/.codex/skills/collaborating-with-gemini/scripts/gemini_bridge.py +275 -0
- package/.codex/skills/crud/SKILL.md +265 -0
- package/.codex/skills/crud-development/SKILL.md +328 -0
- package/.codex/skills/data-permission/SKILL.md +221 -0
- package/.codex/skills/data-permission/references/custom-data-scope.md +90 -0
- package/.codex/skills/database-ops/SKILL.md +210 -0
- package/.codex/skills/dev/SKILL.md +187 -0
- package/.codex/skills/error-handler/SKILL.md +310 -0
- package/.codex/skills/file-oss-management/SKILL.md +260 -0
- package/.codex/skills/file-oss-management/references/entities.md +105 -0
- package/.codex/skills/file-oss-management/references/service-impl.md +104 -0
- package/.codex/skills/fix-bug/SKILL.md +269 -0
- package/.codex/skills/git-workflow/SKILL.md +179 -0
- package/.codex/skills/init-docs/SKILL.md +194 -0
- package/.codex/skills/jenkins-deploy/SKILL.md +134 -0
- package/.codex/skills/json-serialization/SKILL.md +341 -0
- package/.codex/skills/lanhu-design/SKILL.md +99 -0
- package/.codex/skills/leniu-api-development/SKILL.md +319 -0
- package/.codex/skills/leniu-api-development/references/real-examples.md +273 -0
- package/.codex/skills/leniu-architecture-design/SKILL.md +383 -0
- package/.codex/skills/leniu-backend-annotations/SKILL.md +277 -0
- package/.codex/skills/leniu-brainstorm/SKILL.md +242 -0
- package/.codex/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
- package/.codex/skills/leniu-code-patterns/SKILL.md +411 -0
- package/.codex/skills/leniu-crud-development/SKILL.md +404 -0
- package/.codex/skills/leniu-crud-development/references/templates.md +597 -0
- package/.codex/skills/leniu-customization-location/SKILL.md +410 -0
- package/.codex/skills/leniu-data-permission/SKILL.md +341 -0
- package/.codex/skills/leniu-database-ops/SKILL.md +426 -0
- package/.codex/skills/leniu-error-handler/SKILL.md +462 -0
- package/.codex/skills/leniu-java-amount-handling/SKILL.md +461 -0
- package/.codex/skills/leniu-java-code-style/SKILL.md +510 -0
- package/.codex/skills/leniu-java-concurrent/SKILL.md +400 -0
- package/.codex/skills/leniu-java-entity/SKILL.md +237 -0
- package/.codex/skills/leniu-java-entity/references/templates.md +237 -0
- package/.codex/skills/leniu-java-logging/SKILL.md +229 -0
- package/.codex/skills/leniu-java-logging/references/data-mask.md +46 -0
- package/.codex/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
- package/.codex/skills/leniu-java-mq/SKILL.md +338 -0
- package/.codex/skills/leniu-java-mybatis/SKILL.md +267 -0
- package/.codex/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
- package/.codex/skills/leniu-java-task/SKILL.md +367 -0
- package/.codex/skills/leniu-marketing-scenario/SKILL.md +448 -0
- package/.codex/skills/leniu-marketing-scenario/references/pay-meal-rules.md +197 -0
- package/.codex/skills/leniu-marketing-scenario/references/price-rules.md +286 -0
- package/.codex/skills/leniu-marketing-scenario/references/recharge-rules.md +188 -0
- package/.codex/skills/leniu-redis-cache/SKILL.md +331 -0
- package/.codex/skills/leniu-report-scenario/SKILL.md +508 -0
- package/.codex/skills/leniu-report-scenario/references/amount-handling.md +448 -0
- package/.codex/skills/leniu-report-scenario/references/analysis-module.md +64 -0
- package/.codex/skills/leniu-report-scenario/references/customization-table-fields.md +93 -0
- package/.codex/skills/leniu-report-scenario/references/customization.md +356 -0
- package/.codex/skills/leniu-report-scenario/references/data-permission.md +182 -0
- package/.codex/skills/leniu-report-scenario/references/export.md +553 -0
- package/.codex/skills/leniu-report-scenario/references/mealtime.md +197 -0
- package/.codex/skills/leniu-report-scenario/references/query-param.md +274 -0
- package/.codex/skills/leniu-report-scenario/references/report-tables.md +162 -0
- package/.codex/skills/leniu-report-scenario/references/standard-customization.md +112 -0
- package/.codex/skills/leniu-report-scenario/references/standard-table-fields.md +113 -0
- package/.codex/skills/leniu-report-scenario/references/total-line.md +179 -0
- package/.codex/skills/leniu-security-guard/SKILL.md +306 -0
- package/.codex/skills/leniu-utils-toolkit/SKILL.md +380 -0
- package/.codex/skills/loki-log-query/SKILL.md +430 -0
- package/.codex/skills/loki-log-query/environments.json +45 -0
- package/.codex/skills/mysql-debug/SKILL.md +406 -0
- package/.codex/skills/next/SKILL.md +137 -0
- package/.codex/skills/openspec-apply-change/SKILL.md +165 -0
- package/.codex/skills/openspec-archive-change/SKILL.md +122 -0
- package/.codex/skills/openspec-bulk-archive-change/SKILL.md +254 -0
- package/.codex/skills/openspec-continue-change/SKILL.md +126 -0
- package/.codex/skills/openspec-explore/SKILL.md +299 -0
- package/.codex/skills/openspec-ff-change/SKILL.md +109 -0
- package/.codex/skills/openspec-new-change/SKILL.md +82 -0
- package/.codex/skills/openspec-onboard/SKILL.md +414 -0
- package/.codex/skills/openspec-sync-specs/SKILL.md +146 -0
- package/.codex/skills/openspec-verify-change/SKILL.md +176 -0
- package/.codex/skills/performance-doctor/SKILL.md +297 -0
- package/.codex/skills/progress/SKILL.md +193 -0
- package/.codex/skills/project-navigator/SKILL.md +211 -0
- package/.codex/skills/redis-cache/SKILL.md +282 -0
- package/.codex/skills/redis-cache/references/listeners.md +23 -0
- package/.codex/skills/scheduled-jobs/SKILL.md +277 -0
- package/.codex/skills/security-guard/SKILL.md +245 -0
- package/.codex/skills/security-guard/references/encrypt-config.md +103 -0
- package/.codex/skills/security-guard/references/sensitive-strategies.md +42 -0
- package/.codex/skills/skill-creator/LICENSE.txt +202 -0
- package/.codex/skills/skill-creator/SKILL.md +479 -0
- package/.codex/skills/skill-creator/agents/analyzer.md +274 -0
- package/.codex/skills/skill-creator/agents/comparator.md +202 -0
- package/.codex/skills/skill-creator/agents/grader.md +223 -0
- package/.codex/skills/skill-creator/assets/eval_review.html +146 -0
- package/.codex/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/.codex/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/.codex/skills/skill-creator/references/schemas.md +430 -0
- package/.codex/skills/skill-creator/scripts/__init__.py +0 -0
- package/.codex/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/.codex/skills/skill-creator/scripts/generate_report.py +326 -0
- package/.codex/skills/skill-creator/scripts/improve_description.py +248 -0
- package/.codex/skills/skill-creator/scripts/package_skill.py +136 -0
- package/.codex/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/.codex/skills/skill-creator/scripts/run_eval.py +310 -0
- package/.codex/skills/skill-creator/scripts/run_loop.py +332 -0
- package/.codex/skills/skill-creator/scripts/utils.py +47 -0
- package/.codex/skills/sms-mail/SKILL.md +346 -0
- package/.codex/skills/sms-mail/references/mail-config.md +88 -0
- package/.codex/skills/sms-mail/references/sms-config.md +74 -0
- package/.codex/skills/social-login/SKILL.md +328 -0
- package/.codex/skills/social-login/references/provider-configs.md +118 -0
- package/.codex/skills/start/SKILL.md +154 -0
- package/.codex/skills/store-pc/SKILL.md +366 -0
- package/.codex/skills/sync/SKILL.md +149 -0
- package/.codex/skills/sync-back-merge/SKILL.md +66 -0
- package/.codex/skills/task-tracker/SKILL.md +307 -0
- package/.codex/skills/tech-decision/SKILL.md +393 -0
- package/.codex/skills/tenant-management/SKILL.md +272 -0
- package/.codex/skills/tenant-management/references/tenant-scenarios.md +91 -0
- package/.codex/skills/test-development/SKILL.md +301 -0
- package/.codex/skills/test-development/references/parameterized-examples.md +119 -0
- package/.codex/skills/ui-pc/SKILL.md +438 -0
- package/.codex/skills/update-status/SKILL.md +159 -0
- package/.codex/skills/utils-toolkit/SKILL.md +354 -0
- package/.codex/skills/utils-toolkit/references/redis-utils-api.md +56 -0
- package/.codex/skills/websocket-sse/SKILL.md +350 -0
- package/.codex/skills/workflow-engine/SKILL.md +249 -0
- package/.codex/skills/yunxiao-task-management/SKILL.md +401 -0
- package/.codex/skills/yunxiao-task-management/templates//346/217/220/346/265/213/345/215/225/346/250/241/346/235/277.html +17 -0
- package/.cursor/agents/bug-analyzer.md +102 -0
- package/.cursor/agents/code-reviewer.md +122 -0
- package/.cursor/agents/code-scanner.md +145 -0
- package/.cursor/agents/image-reader.md +154 -0
- package/.cursor/agents/loki-runner.md +80 -0
- package/.cursor/agents/mysql-runner.md +81 -0
- package/.cursor/agents/project-manager.md +159 -0
- package/.cursor/agents/requirements-analyzer.md +141 -0
- package/.cursor/agents/task-fetcher.md +75 -0
- package/.cursor/audio/completed.wav +0 -0
- package/.cursor/commands/opsx-apply.md +152 -0
- package/.cursor/commands/opsx-archive.md +157 -0
- package/.cursor/commands/opsx-bulk-archive.md +242 -0
- package/.cursor/commands/opsx-continue.md +114 -0
- package/.cursor/commands/opsx-explore.md +174 -0
- package/.cursor/commands/opsx-ff.md +94 -0
- package/.cursor/commands/opsx-new.md +69 -0
- package/.cursor/commands/opsx-onboard.md +525 -0
- package/.cursor/commands/opsx-sync.md +134 -0
- package/.cursor/commands/opsx-verify.md +164 -0
- package/.cursor/hooks/cursor-pre-tool-use.js +122 -0
- package/.cursor/hooks/cursor-skill-eval.js +466 -0
- package/.cursor/hooks/lib/notify.js +310 -0
- package/.cursor/hooks/stop.js +55 -0
- package/.cursor/hooks.json +23 -0
- package/.cursor/mcp.json +22 -0
- package/.cursor/rules/skill-activation.mdc +99 -0
- package/.cursor/skills/add-skill/SKILL.md +488 -0
- package/.cursor/skills/analyze-requirements/SKILL.md +112 -0
- package/.cursor/skills/api-development/SKILL.md +315 -0
- package/.cursor/skills/architecture-design/SKILL.md +152 -0
- package/.cursor/skills/auto-test/SKILL.md +453 -0
- package/.cursor/skills/auto-test/references/api-conventions.md +260 -0
- package/.cursor/skills/backend-annotations/SKILL.md +248 -0
- package/.cursor/skills/banana-image/CHANGELOG.md +37 -0
- package/.cursor/skills/banana-image/README.md +146 -0
- package/.cursor/skills/banana-image/SKILL.md +171 -0
- package/.cursor/skills/banana-image/assets/logo.png +0 -0
- package/.cursor/skills/banana-image/references/advanced-usage.md +189 -0
- package/.cursor/skills/banana-image/scripts/apply_template.py +125 -0
- package/.cursor/skills/banana-image/scripts/banana_image_exec.ts +412 -0
- package/.cursor/skills/banana-image/scripts/batch_prep.py +82 -0
- package/.cursor/skills/banana-image/scripts/package-lock.json +1437 -0
- package/.cursor/skills/banana-image/scripts/package.json +18 -0
- package/.cursor/skills/banana-image/scripts/requirements.txt +10 -0
- package/.cursor/skills/banana-image/templates/poster.json +22 -0
- package/.cursor/skills/banana-image/templates/product.json +17 -0
- package/.cursor/skills/banana-image/templates/social.json +22 -0
- package/.cursor/skills/banana-image/templates/thumbnail.json +17 -0
- package/.cursor/skills/brainstorm/SKILL.md +216 -0
- package/.cursor/skills/bug-detective/SKILL.md +295 -0
- package/.cursor/skills/bug-detective/references/error-patterns.md +242 -0
- package/.cursor/skills/code-patterns/SKILL.md +163 -0
- package/.cursor/skills/code-patterns/references/leniu-code-patterns.md +87 -0
- package/.cursor/skills/collaborating-with-codex/SKILL.md +180 -0
- package/.cursor/skills/collaborating-with-codex/scripts/codex_bridge.py +275 -0
- package/.cursor/skills/collaborating-with-gemini/SKILL.md +194 -0
- package/.cursor/skills/collaborating-with-gemini/scripts/gemini_bridge.py +275 -0
- package/.cursor/skills/crud-development/SKILL.md +328 -0
- package/.cursor/skills/data-permission/SKILL.md +221 -0
- package/.cursor/skills/data-permission/references/custom-data-scope.md +90 -0
- package/.cursor/skills/database-ops/SKILL.md +210 -0
- package/.cursor/skills/error-handler/SKILL.md +310 -0
- package/.cursor/skills/file-oss-management/SKILL.md +260 -0
- package/.cursor/skills/file-oss-management/references/entities.md +105 -0
- package/.cursor/skills/file-oss-management/references/service-impl.md +104 -0
- package/.cursor/skills/fix-bug/SKILL.md +269 -0
- package/.cursor/skills/git-workflow/SKILL.md +179 -0
- package/.cursor/skills/jenkins-deploy/SKILL.md +134 -0
- package/.cursor/skills/json-serialization/SKILL.md +341 -0
- package/.cursor/skills/lanhu-design/SKILL.md +99 -0
- package/.cursor/skills/leniu-api-development/SKILL.md +319 -0
- package/.cursor/skills/leniu-api-development/references/real-examples.md +273 -0
- package/.cursor/skills/leniu-architecture-design/SKILL.md +383 -0
- package/.cursor/skills/leniu-backend-annotations/SKILL.md +277 -0
- package/.cursor/skills/leniu-brainstorm/SKILL.md +242 -0
- package/.cursor/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
- package/.cursor/skills/leniu-code-patterns/SKILL.md +411 -0
- package/.cursor/skills/leniu-crud-development/SKILL.md +404 -0
- package/.cursor/skills/leniu-crud-development/references/templates.md +597 -0
- package/.cursor/skills/leniu-customization-location/SKILL.md +410 -0
- package/.cursor/skills/leniu-data-permission/SKILL.md +341 -0
- package/.cursor/skills/leniu-database-ops/SKILL.md +426 -0
- package/.cursor/skills/leniu-error-handler/SKILL.md +462 -0
- package/.cursor/skills/leniu-java-amount-handling/SKILL.md +461 -0
- package/.cursor/skills/leniu-java-code-style/SKILL.md +510 -0
- package/.cursor/skills/leniu-java-concurrent/SKILL.md +400 -0
- package/.cursor/skills/leniu-java-entity/SKILL.md +237 -0
- package/.cursor/skills/leniu-java-entity/references/templates.md +237 -0
- package/.cursor/skills/leniu-java-logging/SKILL.md +229 -0
- package/.cursor/skills/leniu-java-logging/references/data-mask.md +46 -0
- package/.cursor/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
- package/.cursor/skills/leniu-java-mq/SKILL.md +338 -0
- package/.cursor/skills/leniu-java-mybatis/SKILL.md +267 -0
- package/.cursor/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
- package/.cursor/skills/leniu-java-task/SKILL.md +367 -0
- package/.cursor/skills/leniu-marketing-scenario/SKILL.md +448 -0
- package/.cursor/skills/leniu-marketing-scenario/references/pay-meal-rules.md +197 -0
- package/.cursor/skills/leniu-marketing-scenario/references/price-rules.md +286 -0
- package/.cursor/skills/leniu-marketing-scenario/references/recharge-rules.md +188 -0
- package/.cursor/skills/leniu-redis-cache/SKILL.md +331 -0
- package/.cursor/skills/leniu-report-scenario/SKILL.md +508 -0
- package/.cursor/skills/leniu-report-scenario/references/amount-handling.md +448 -0
- package/.cursor/skills/leniu-report-scenario/references/analysis-module.md +64 -0
- package/.cursor/skills/leniu-report-scenario/references/customization-table-fields.md +93 -0
- package/.cursor/skills/leniu-report-scenario/references/customization.md +356 -0
- package/.cursor/skills/leniu-report-scenario/references/data-permission.md +182 -0
- package/.cursor/skills/leniu-report-scenario/references/export.md +553 -0
- package/.cursor/skills/leniu-report-scenario/references/mealtime.md +197 -0
- package/.cursor/skills/leniu-report-scenario/references/query-param.md +274 -0
- package/.cursor/skills/leniu-report-scenario/references/report-tables.md +162 -0
- package/.cursor/skills/leniu-report-scenario/references/standard-customization.md +112 -0
- package/.cursor/skills/leniu-report-scenario/references/standard-table-fields.md +113 -0
- package/.cursor/skills/leniu-report-scenario/references/total-line.md +179 -0
- package/.cursor/skills/leniu-security-guard/SKILL.md +306 -0
- package/.cursor/skills/leniu-utils-toolkit/SKILL.md +380 -0
- package/.cursor/skills/loki-log-query/SKILL.md +430 -0
- package/.cursor/skills/loki-log-query/environments.json +45 -0
- package/.cursor/skills/mysql-debug/SKILL.md +406 -0
- package/.cursor/skills/openspec-apply-change/SKILL.md +165 -0
- package/.cursor/skills/openspec-archive-change/SKILL.md +122 -0
- package/.cursor/skills/openspec-bulk-archive-change/SKILL.md +254 -0
- package/.cursor/skills/openspec-continue-change/SKILL.md +126 -0
- package/.cursor/skills/openspec-explore/SKILL.md +299 -0
- package/.cursor/skills/openspec-ff-change/SKILL.md +109 -0
- package/.cursor/skills/openspec-new-change/SKILL.md +82 -0
- package/.cursor/skills/openspec-onboard/SKILL.md +414 -0
- package/.cursor/skills/openspec-sync-specs/SKILL.md +146 -0
- package/.cursor/skills/openspec-verify-change/SKILL.md +176 -0
- package/.cursor/skills/performance-doctor/SKILL.md +297 -0
- package/.cursor/skills/project-navigator/SKILL.md +211 -0
- package/.cursor/skills/redis-cache/SKILL.md +282 -0
- package/.cursor/skills/redis-cache/references/listeners.md +23 -0
- package/.cursor/skills/scheduled-jobs/SKILL.md +277 -0
- package/.cursor/skills/security-guard/SKILL.md +245 -0
- package/.cursor/skills/security-guard/references/encrypt-config.md +103 -0
- package/.cursor/skills/security-guard/references/sensitive-strategies.md +42 -0
- package/.cursor/skills/skill-creator/LICENSE.txt +202 -0
- package/.cursor/skills/skill-creator/SKILL.md +479 -0
- package/.cursor/skills/skill-creator/agents/analyzer.md +274 -0
- package/.cursor/skills/skill-creator/agents/comparator.md +202 -0
- package/.cursor/skills/skill-creator/agents/grader.md +223 -0
- package/.cursor/skills/skill-creator/assets/eval_review.html +146 -0
- package/.cursor/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/.cursor/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/.cursor/skills/skill-creator/references/schemas.md +430 -0
- package/.cursor/skills/skill-creator/scripts/__init__.py +0 -0
- package/.cursor/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/.cursor/skills/skill-creator/scripts/generate_report.py +326 -0
- package/.cursor/skills/skill-creator/scripts/improve_description.py +248 -0
- package/.cursor/skills/skill-creator/scripts/package_skill.py +136 -0
- package/.cursor/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/.cursor/skills/skill-creator/scripts/run_eval.py +310 -0
- package/.cursor/skills/skill-creator/scripts/run_loop.py +332 -0
- package/.cursor/skills/skill-creator/scripts/utils.py +47 -0
- package/.cursor/skills/sms-mail/SKILL.md +346 -0
- package/.cursor/skills/sms-mail/references/mail-config.md +88 -0
- package/.cursor/skills/sms-mail/references/sms-config.md +74 -0
- package/.cursor/skills/social-login/SKILL.md +328 -0
- package/.cursor/skills/social-login/references/provider-configs.md +118 -0
- package/.cursor/skills/store-pc/SKILL.md +366 -0
- package/.cursor/skills/sync-back-merge/SKILL.md +66 -0
- package/.cursor/skills/task-tracker/SKILL.md +307 -0
- package/.cursor/skills/tech-decision/SKILL.md +393 -0
- package/.cursor/skills/tenant-management/SKILL.md +272 -0
- package/.cursor/skills/tenant-management/references/tenant-scenarios.md +91 -0
- package/.cursor/skills/test-development/SKILL.md +301 -0
- package/.cursor/skills/test-development/references/parameterized-examples.md +119 -0
- package/.cursor/skills/ui-pc/SKILL.md +438 -0
- package/.cursor/skills/utils-toolkit/SKILL.md +354 -0
- package/.cursor/skills/utils-toolkit/references/redis-utils-api.md +56 -0
- package/.cursor/skills/websocket-sse/SKILL.md +350 -0
- package/.cursor/skills/workflow-engine/SKILL.md +249 -0
- package/.cursor/skills/yunxiao-task-management/SKILL.md +401 -0
- package/.cursor/skills/yunxiao-task-management/templates//346/217/220/346/265/213/345/215/225/346/250/241/346/235/277.html +17 -0
- package/.cursor/templates/env-config.md +27 -0
- package/AGENTS.md +275 -0
- package/CLAUDE.md +285 -0
- package/README.md +104 -0
- package/bin/index.js +3069 -0
- package/init.sh +178 -0
- package/package.json +40 -0
- package/scripts/build-skills.js +180 -0
- package/src/platform-map.json +100 -0
- package/src/skills/add-skill/SKILL.md +488 -0
- package/src/skills/add-todo/SKILL.md +269 -0
- package/src/skills/analyze-requirements/SKILL.md +112 -0
- package/src/skills/api-development/SKILL.md +315 -0
- package/src/skills/architecture-design/SKILL.md +152 -0
- package/src/skills/backend-annotations/SKILL.md +248 -0
- package/src/skills/banana-image/CHANGELOG.md +37 -0
- package/src/skills/banana-image/README.md +146 -0
- package/src/skills/banana-image/SKILL.md +171 -0
- package/src/skills/banana-image/assets/logo.png +0 -0
- package/src/skills/banana-image/references/advanced-usage.md +189 -0
- package/src/skills/banana-image/scripts/apply_template.py +125 -0
- package/src/skills/banana-image/scripts/banana_image_exec.ts +412 -0
- package/src/skills/banana-image/scripts/batch_prep.py +82 -0
- package/src/skills/banana-image/scripts/package-lock.json +1437 -0
- package/src/skills/banana-image/scripts/package.json +18 -0
- package/src/skills/banana-image/scripts/requirements.txt +10 -0
- package/src/skills/banana-image/templates/poster.json +22 -0
- package/src/skills/banana-image/templates/product.json +17 -0
- package/src/skills/banana-image/templates/social.json +22 -0
- package/src/skills/banana-image/templates/thumbnail.json +17 -0
- package/src/skills/brainstorm/SKILL.md +216 -0
- package/src/skills/bug-detective/SKILL.md +295 -0
- package/src/skills/bug-detective/references/error-patterns.md +242 -0
- package/src/skills/check/SKILL.md +367 -0
- package/src/skills/code-patterns/SKILL.md +163 -0
- package/src/skills/code-patterns/references/leniu-code-patterns.md +87 -0
- package/src/skills/codex-code-review/SKILL.md +327 -0
- package/src/skills/collaborating-with-codex/SKILL.md +180 -0
- package/src/skills/collaborating-with-codex/scripts/codex_bridge.py +275 -0
- package/src/skills/collaborating-with-gemini/SKILL.md +194 -0
- package/src/skills/collaborating-with-gemini/scripts/gemini_bridge.py +275 -0
- package/src/skills/crud/SKILL.md +265 -0
- package/src/skills/crud-development/SKILL.md +328 -0
- package/src/skills/data-permission/SKILL.md +221 -0
- package/src/skills/data-permission/references/custom-data-scope.md +90 -0
- package/src/skills/database-ops/SKILL.md +210 -0
- package/src/skills/dev/SKILL.md +187 -0
- package/src/skills/error-handler/SKILL.md +310 -0
- package/src/skills/file-oss-management/SKILL.md +260 -0
- package/src/skills/file-oss-management/references/entities.md +105 -0
- package/src/skills/file-oss-management/references/service-impl.md +104 -0
- package/src/skills/fix-bug/SKILL.md +269 -0
- package/src/skills/git-workflow/SKILL.md +179 -0
- package/src/skills/init-docs/SKILL.md +194 -0
- package/src/skills/json-serialization/SKILL.md +341 -0
- package/src/skills/leniu-api-development/SKILL.md +319 -0
- package/src/skills/leniu-api-development/references/real-examples.md +273 -0
- package/src/skills/leniu-architecture-design/SKILL.md +383 -0
- package/src/skills/leniu-backend-annotations/SKILL.md +277 -0
- package/src/skills/leniu-brainstorm/SKILL.md +242 -0
- package/src/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
- package/src/skills/leniu-code-patterns/SKILL.md +411 -0
- package/src/skills/leniu-crud-development/SKILL.md +404 -0
- package/src/skills/leniu-crud-development/references/templates.md +597 -0
- package/src/skills/leniu-customization-location/SKILL.md +410 -0
- package/src/skills/leniu-data-permission/SKILL.md +341 -0
- package/src/skills/leniu-database-ops/SKILL.md +426 -0
- package/src/skills/leniu-error-handler/SKILL.md +462 -0
- package/src/skills/leniu-java-amount-handling/SKILL.md +461 -0
- package/src/skills/leniu-java-code-style/SKILL.md +510 -0
- package/src/skills/leniu-java-concurrent/SKILL.md +400 -0
- package/src/skills/leniu-java-entity/SKILL.md +237 -0
- package/src/skills/leniu-java-entity/references/templates.md +237 -0
- package/src/skills/leniu-java-export/SKILL.md +570 -0
- package/src/skills/leniu-java-logging/SKILL.md +229 -0
- package/src/skills/leniu-java-logging/references/data-mask.md +46 -0
- package/src/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
- package/src/skills/leniu-java-mq/SKILL.md +338 -0
- package/src/skills/leniu-java-mybatis/SKILL.md +267 -0
- package/src/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
- package/src/skills/leniu-java-report-query-param/SKILL.md +291 -0
- package/src/skills/leniu-java-task/SKILL.md +367 -0
- package/src/skills/leniu-java-total-line/SKILL.md +196 -0
- package/src/skills/leniu-marketing-price-rule-customizer/SKILL.md +301 -0
- package/src/skills/leniu-marketing-recharge-rule-customizer/SKILL.md +285 -0
- package/src/skills/leniu-mealtime/SKILL.md +215 -0
- package/src/skills/leniu-redis-cache/SKILL.md +331 -0
- package/src/skills/leniu-report-customization/SKILL.md +415 -0
- package/src/skills/leniu-report-customization/references/table-fields.md +93 -0
- package/src/skills/leniu-report-standard-customization/SKILL.md +391 -0
- package/src/skills/leniu-report-standard-customization/references/analysis-module.md +64 -0
- package/src/skills/leniu-report-standard-customization/references/table-fields.md +113 -0
- package/src/skills/leniu-security-guard/SKILL.md +306 -0
- package/src/skills/leniu-utils-toolkit/SKILL.md +380 -0
- package/src/skills/loki-log-query/SKILL.md +400 -0
- package/src/skills/loki-log-query/environments.json +45 -0
- package/src/skills/mysql-debug/SKILL.md +400 -0
- package/src/skills/next/SKILL.md +137 -0
- package/src/skills/openspec-apply-change/SKILL.md +165 -0
- package/src/skills/openspec-archive-change/SKILL.md +122 -0
- package/src/skills/openspec-bulk-archive-change/SKILL.md +254 -0
- package/src/skills/openspec-continue-change/SKILL.md +126 -0
- package/src/skills/openspec-explore/SKILL.md +299 -0
- package/src/skills/openspec-ff-change/SKILL.md +109 -0
- package/src/skills/openspec-new-change/SKILL.md +82 -0
- package/src/skills/openspec-onboard/SKILL.md +414 -0
- package/src/skills/openspec-sync-specs/SKILL.md +146 -0
- package/src/skills/openspec-verify-change/SKILL.md +176 -0
- package/src/skills/performance-doctor/SKILL.md +297 -0
- package/src/skills/progress/SKILL.md +193 -0
- package/src/skills/project-navigator/SKILL.md +211 -0
- package/src/skills/redis-cache/SKILL.md +282 -0
- package/src/skills/redis-cache/references/listeners.md +23 -0
- package/src/skills/scheduled-jobs/SKILL.md +277 -0
- package/src/skills/security-guard/SKILL.md +245 -0
- package/src/skills/security-guard/references/encrypt-config.md +103 -0
- package/src/skills/security-guard/references/sensitive-strategies.md +42 -0
- package/src/skills/skill-creator/LICENSE.txt +202 -0
- package/src/skills/skill-creator/SKILL.md +479 -0
- package/src/skills/skill-creator/agents/analyzer.md +274 -0
- package/src/skills/skill-creator/agents/comparator.md +202 -0
- package/src/skills/skill-creator/agents/grader.md +223 -0
- package/src/skills/skill-creator/assets/eval_review.html +146 -0
- package/src/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/src/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/src/skills/skill-creator/references/schemas.md +430 -0
- package/src/skills/skill-creator/scripts/__init__.py +0 -0
- package/src/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/src/skills/skill-creator/scripts/generate_report.py +326 -0
- package/src/skills/skill-creator/scripts/improve_description.py +248 -0
- package/src/skills/skill-creator/scripts/package_skill.py +136 -0
- package/src/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/src/skills/skill-creator/scripts/run_eval.py +310 -0
- package/src/skills/skill-creator/scripts/run_loop.py +332 -0
- package/src/skills/skill-creator/scripts/utils.py +47 -0
- package/src/skills/sms-mail/SKILL.md +346 -0
- package/src/skills/sms-mail/references/mail-config.md +88 -0
- package/src/skills/sms-mail/references/sms-config.md +74 -0
- package/src/skills/social-login/SKILL.md +328 -0
- package/src/skills/social-login/references/provider-configs.md +118 -0
- package/src/skills/start/SKILL.md +154 -0
- package/src/skills/store-pc/SKILL.md +366 -0
- package/src/skills/sync/SKILL.md +149 -0
- package/src/skills/sync-back-merge/SKILL.md +66 -0
- package/src/skills/task-tracker/SKILL.md +307 -0
- package/src/skills/tech-decision/SKILL.md +393 -0
- package/src/skills/tenant-management/SKILL.md +272 -0
- package/src/skills/tenant-management/references/tenant-scenarios.md +91 -0
- package/src/skills/test-development/SKILL.md +301 -0
- package/src/skills/test-development/references/parameterized-examples.md +119 -0
- package/src/skills/ui-pc/SKILL.md +438 -0
- package/src/skills/update-status/SKILL.md +159 -0
- package/src/skills/utils-toolkit/SKILL.md +354 -0
- package/src/skills/utils-toolkit/references/redis-utils-api.md +56 -0
- package/src/skills/websocket-sse/SKILL.md +350 -0
- package/src/skills/workflow-engine/SKILL.md +249 -0
- package/src/skills/yunxiao-task-management/SKILL.md +401 -0
- package/src/skills/yunxiao-task-management/templates//346/217/220/346/265/213/345/215/225/346/250/241/346/235/277.html +17 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scheduled-jobs
|
|
3
|
+
description: |
|
|
4
|
+
通用定时任务开发指南。涵盖 @Scheduled、Quartz、XXL-Job 等方案的概念对比与实现模式。
|
|
5
|
+
触发场景:
|
|
6
|
+
- 每日数据汇总、定期清理等周期性任务
|
|
7
|
+
- 分布式任务调度、失败重试
|
|
8
|
+
- 任务分片、广播任务
|
|
9
|
+
- 可视化任务管理和监控
|
|
10
|
+
触发词:定时任务、任务调度、@Scheduled、Quartz、XXL-Job、Cron、重试、分片任务、广播任务、分布式任务
|
|
11
|
+
注意:如果项目有专属技能(如 `leniu-java-task`),优先使用专属版本。
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# 定时任务开发指南
|
|
15
|
+
|
|
16
|
+
> 通用模板。如果项目有专属技能(如 `leniu-java-task`),优先使用。
|
|
17
|
+
|
|
18
|
+
## 设计原则
|
|
19
|
+
|
|
20
|
+
1. **幂等性**:任务重复执行不会产生副作用。考虑任务被重试、多次调度的情况。
|
|
21
|
+
2. **可观测**:任务执行结果必须可追踪(日志、监控、告警)。
|
|
22
|
+
3. **故障隔离**:单个任务失败不应影响其他任务的调度。
|
|
23
|
+
4. **超时控制**:设置合理的执行超时时间,避免任务无限阻塞。
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 方案对比
|
|
28
|
+
|
|
29
|
+
| 维度 | @Scheduled | Quartz | XXL-Job | 其他(SnailJob 等) |
|
|
30
|
+
|------|-----------|--------|---------|-------------------|
|
|
31
|
+
| 学习成本 | 极低 | 中等 | 低 | 低-中 |
|
|
32
|
+
| 分布式支持 | 无 | 支持(数据库锁) | 原生支持 | 原生支持 |
|
|
33
|
+
| 可视化管理 | 无 | 无(需自建) | Web 控制台 | Web 控制台 |
|
|
34
|
+
| 失败重试 | 无 | 支持 | 支持 | 支持 |
|
|
35
|
+
| 任务分片 | 不支持 | 不支持 | 支持 | 支持 |
|
|
36
|
+
| 广播模式 | 不支持 | 不支持 | 支持 | 支持 |
|
|
37
|
+
| 工作流编排 | 不支持 | 不支持 | 子任务依赖 | 部分支持 |
|
|
38
|
+
| 依赖 | Spring 内置 | quartz jar | 独立服务 | 独立服务 |
|
|
39
|
+
| 适用场景 | 简单周期任务 | 中等复杂度 | 生产级分布式 | 生产级分布式 |
|
|
40
|
+
|
|
41
|
+
### 选型决策树
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
需要分布式调度?
|
|
45
|
+
├── 否 → @Scheduled(简单定时)
|
|
46
|
+
└── 是 → 需要可视化管理?
|
|
47
|
+
├── 否 → Quartz + 数据库(中等规模)
|
|
48
|
+
└── 是 → XXL-Job / SnailJob / PowerJob(生产推荐)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 实现模式
|
|
54
|
+
|
|
55
|
+
### 方案一:@Scheduled(Spring 内置)
|
|
56
|
+
|
|
57
|
+
```java
|
|
58
|
+
@Component
|
|
59
|
+
@EnableScheduling
|
|
60
|
+
public class SimpleScheduledTasks {
|
|
61
|
+
|
|
62
|
+
// 固定频率:每30秒执行一次
|
|
63
|
+
@Scheduled(fixedRate = 30000)
|
|
64
|
+
public void heartbeat() {
|
|
65
|
+
log.info("心跳检测");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 固定延迟:上次执行完成后等10秒再执行
|
|
69
|
+
@Scheduled(fixedDelay = 10000)
|
|
70
|
+
public void cleanTempFiles() {
|
|
71
|
+
log.info("清理临时文件");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Cron 表达式:每天凌晨2点执行
|
|
75
|
+
@Scheduled(cron = "0 0 2 * * ?")
|
|
76
|
+
public void dailyReport() {
|
|
77
|
+
log.info("生成日报");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 使用配置文件中的 Cron
|
|
81
|
+
@Scheduled(cron = "${task.cleanup.cron:0 0 3 * * ?}")
|
|
82
|
+
public void configuredTask() {
|
|
83
|
+
log.info("可配置的定时任务");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**注意事项**:
|
|
89
|
+
- 默认单线程执行,需配置线程池避免任务阻塞
|
|
90
|
+
- 多实例部署时每个实例都会执行,需分布式锁控制
|
|
91
|
+
|
|
92
|
+
```java
|
|
93
|
+
@Configuration
|
|
94
|
+
public class SchedulingConfig implements SchedulingConfigurer {
|
|
95
|
+
@Override
|
|
96
|
+
public void configureTasks(ScheduledTaskRegistrar registrar) {
|
|
97
|
+
registrar.setScheduler(Executors.newScheduledThreadPool(5));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 方案二:Quartz
|
|
103
|
+
|
|
104
|
+
```java
|
|
105
|
+
// 1. 定义 Job
|
|
106
|
+
public class OrderCleanupJob implements Job {
|
|
107
|
+
@Override
|
|
108
|
+
public void execute(JobExecutionContext context) throws JobExecutionException {
|
|
109
|
+
JobDataMap dataMap = context.getMergedJobDataMap();
|
|
110
|
+
int days = dataMap.getInt("retentionDays");
|
|
111
|
+
// 业务逻辑...
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// 2. 配置调度
|
|
116
|
+
@Configuration
|
|
117
|
+
public class QuartzConfig {
|
|
118
|
+
|
|
119
|
+
@Bean
|
|
120
|
+
public JobDetail orderCleanupJobDetail() {
|
|
121
|
+
return JobBuilder.newJob(OrderCleanupJob.class)
|
|
122
|
+
.withIdentity("orderCleanup", "maintenance")
|
|
123
|
+
.usingJobData("retentionDays", 30)
|
|
124
|
+
.storeDurably()
|
|
125
|
+
.build();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@Bean
|
|
129
|
+
public Trigger orderCleanupTrigger() {
|
|
130
|
+
return TriggerBuilder.newTrigger()
|
|
131
|
+
.forJob(orderCleanupJobDetail())
|
|
132
|
+
.withIdentity("orderCleanupTrigger", "maintenance")
|
|
133
|
+
.withSchedule(CronScheduleBuilder.cronSchedule("0 0 2 * * ?"))
|
|
134
|
+
.build();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 方案三:分布式任务调度平台(XXL-Job 等)
|
|
140
|
+
|
|
141
|
+
```java
|
|
142
|
+
// 通用模式:注解标记任务处理器
|
|
143
|
+
@Component
|
|
144
|
+
public class OrderCleanupJobHandler {
|
|
145
|
+
|
|
146
|
+
@Autowired
|
|
147
|
+
private OrderService orderService;
|
|
148
|
+
|
|
149
|
+
// 具体注解取决于所选平台
|
|
150
|
+
// XXL-Job: @XxlJob("orderCleanupHandler")
|
|
151
|
+
// SnailJob: @JobExecutor(name = "orderCleanupJob")
|
|
152
|
+
public void execute(String params) {
|
|
153
|
+
log.info("开始清理过期订单");
|
|
154
|
+
try {
|
|
155
|
+
int days = StringUtils.isBlank(params) ? 30 : Integer.parseInt(params);
|
|
156
|
+
int count = orderService.cleanupExpiredOrders(days);
|
|
157
|
+
log.info("清理完成,删除 {} 条", count);
|
|
158
|
+
} catch (Exception e) {
|
|
159
|
+
log.error("清理失败: {}", e.getMessage());
|
|
160
|
+
throw e; // 抛出异常触发平台重试
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 执行模式
|
|
167
|
+
|
|
168
|
+
| 模式 | 特点 | 适用场景 |
|
|
169
|
+
|------|------|---------|
|
|
170
|
+
| **集群/随机** | 多节点竞争,只有一个执行 | 订单处理、数据汇总 |
|
|
171
|
+
| **广播** | 所有节点都执行 | 清理本地缓存、刷新配置 |
|
|
172
|
+
| **分片** | 按规则分片,每节点处理部分数据 | 大数据量批处理 |
|
|
173
|
+
| **MapReduce** | 动态分片 + 结果汇总 | 分布式计算、统计 |
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## 最佳实践
|
|
178
|
+
|
|
179
|
+
### 标准任务模板
|
|
180
|
+
|
|
181
|
+
```java
|
|
182
|
+
@Component
|
|
183
|
+
public class [你的任务类] {
|
|
184
|
+
|
|
185
|
+
private static final Logger log = LoggerFactory.getLogger([你的任务类].class);
|
|
186
|
+
|
|
187
|
+
@Autowired
|
|
188
|
+
private [你的业务Service] bizService;
|
|
189
|
+
|
|
190
|
+
public void execute(String params) {
|
|
191
|
+
long startTime = System.currentTimeMillis();
|
|
192
|
+
log.info("[任务开始] 参数: {}", params);
|
|
193
|
+
|
|
194
|
+
try {
|
|
195
|
+
// 1. 解析参数
|
|
196
|
+
int days = parseParams(params);
|
|
197
|
+
|
|
198
|
+
// 2. 幂等检查
|
|
199
|
+
if (bizService.isAlreadyProcessed(today())) {
|
|
200
|
+
log.info("[任务跳过] 今日已执行");
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// 3. 执行业务逻辑
|
|
205
|
+
int count = bizService.process(days);
|
|
206
|
+
|
|
207
|
+
// 4. 记录结果
|
|
208
|
+
long cost = System.currentTimeMillis() - startTime;
|
|
209
|
+
log.info("[任务完成] 处理 {} 条,耗时 {} ms", count, cost);
|
|
210
|
+
|
|
211
|
+
} catch (Exception e) {
|
|
212
|
+
log.error("[任务失败] {}", e.getMessage(), e);
|
|
213
|
+
throw e; // 抛出异常触发重试
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### 重试策略对比
|
|
220
|
+
|
|
221
|
+
| 策略 | 说明 | 适用场景 |
|
|
222
|
+
|------|------|---------|
|
|
223
|
+
| 固定间隔 | 每次间隔相同(如 30s) | 网络抖动、临时故障 |
|
|
224
|
+
| 指数退避 | 间隔逐倍增加(1s, 2s, 4s, 8s...) | 服务恢复中 |
|
|
225
|
+
| Cron 重试 | 按 Cron 表达式重试 | 定点重试 |
|
|
226
|
+
| 最大次数 | 限制最大重试次数 | 防止无限重试 |
|
|
227
|
+
|
|
228
|
+
### Cron 表达式速查
|
|
229
|
+
|
|
230
|
+
| 表达式 | 含义 |
|
|
231
|
+
|--------|------|
|
|
232
|
+
| `0 0 2 * * ?` | 每天凌晨 2:00 |
|
|
233
|
+
| `0 0/30 * * * ?` | 每 30 分钟 |
|
|
234
|
+
| `0 0 9-18 * * MON-FRI` | 工作日 9-18 点每小时 |
|
|
235
|
+
| `0 0 0 1 * ?` | 每月 1 号零点 |
|
|
236
|
+
| `0 0 0 L * ?` | 每月最后一天零点 |
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## 常见错误
|
|
241
|
+
|
|
242
|
+
```java
|
|
243
|
+
// 1. @Scheduled 任务中抛出异常但不处理
|
|
244
|
+
@Scheduled(fixedRate = 60000)
|
|
245
|
+
public void task() {
|
|
246
|
+
service.process(); // 异常后任务停止调度!
|
|
247
|
+
}
|
|
248
|
+
// 应捕获异常
|
|
249
|
+
@Scheduled(fixedRate = 60000)
|
|
250
|
+
public void task() {
|
|
251
|
+
try {
|
|
252
|
+
service.process();
|
|
253
|
+
} catch (Exception e) {
|
|
254
|
+
log.error("任务执行失败", e);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// 2. @Scheduled 默认单线程,长任务阻塞其他任务
|
|
259
|
+
// 应配置线程池(见上文 SchedulingConfig)
|
|
260
|
+
|
|
261
|
+
// 3. 多实例部署未做互斥
|
|
262
|
+
// @Scheduled 每个实例都执行 -> 数据重复处理
|
|
263
|
+
// 应使用分布式锁(Redis / 数据库)或分布式调度平台
|
|
264
|
+
|
|
265
|
+
// 4. 任务非幂等
|
|
266
|
+
public void syncData() {
|
|
267
|
+
insertAll(fetchData()); // 重复执行会插入重复数据
|
|
268
|
+
}
|
|
269
|
+
// 应先检查是否已处理
|
|
270
|
+
|
|
271
|
+
// 5. 任务内开启大事务
|
|
272
|
+
@Transactional
|
|
273
|
+
public void processAllOrders() {
|
|
274
|
+
// 处理百万条数据在一个事务中 -> 内存溢出、锁超时
|
|
275
|
+
}
|
|
276
|
+
// 应分批处理,每批独立事务
|
|
277
|
+
```
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-guard
|
|
3
|
+
description: |
|
|
4
|
+
通用后端安全开发指南。包含认证授权模式对比、输入校验、XSS/SQL注入防护、数据脱敏加密、安全检查清单。
|
|
5
|
+
触发场景:
|
|
6
|
+
- 设计认证授权方案
|
|
7
|
+
- 配置权限校验
|
|
8
|
+
- 防护 XSS / SQL 注入
|
|
9
|
+
- 数据脱敏 / 加密处理
|
|
10
|
+
- 安全合规审查
|
|
11
|
+
触发词:安全、认证、授权、权限、Token、登录、XSS、SQL注入、脱敏、加密、RBAC、OAuth、CORS、漏洞防护
|
|
12
|
+
注意:如果项目有专属技能(如 `leniu-security-guard`),优先使用专属版本。
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# 安全开发指南
|
|
16
|
+
|
|
17
|
+
> 通用模板。如果项目有专属技能(如 `leniu-security-guard`),优先使用。
|
|
18
|
+
|
|
19
|
+
## 设计原则
|
|
20
|
+
|
|
21
|
+
1. **纵深防御**:不依赖单一安全机制,从传输层、认证层、授权层、数据层多维度防护。
|
|
22
|
+
2. **最小权限**:默认拒绝,显式授权。每个接口必须声明所需权限。
|
|
23
|
+
3. **输入不可信**:所有外部输入(用户参数、请求头、Cookie)必须校验后使用。
|
|
24
|
+
4. **敏感数据保护**:存储加密、传输加密、展示脱敏,三层保护。
|
|
25
|
+
5. **审计可追溯**:关键操作记录日志,包含操作人、操作时间、操作内容。
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 认证授权方案对比
|
|
30
|
+
|
|
31
|
+
| 维度 | Spring Security | Apache Shiro | Sa-Token |
|
|
32
|
+
|------|----------------|-------------|----------|
|
|
33
|
+
| 学习曲线 | 陡峭 | 中等 | 平缓 |
|
|
34
|
+
| 功能丰富度 | 最全面 | 基础够用 | 功能丰富 |
|
|
35
|
+
| Spring 集成 | 原生集成 | 需适配 | 自动配置 |
|
|
36
|
+
| OAuth2 支持 | 原生支持 | 需扩展 | 内置 SSO |
|
|
37
|
+
| 微服务支持 | 优秀 | 一般 | 良好 |
|
|
38
|
+
| 适用场景 | 企业级、复杂权限 | 轻量项目 | 快速开发 |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 实现模式
|
|
43
|
+
|
|
44
|
+
### 1. 认证(Authentication)
|
|
45
|
+
|
|
46
|
+
```java
|
|
47
|
+
// 方式一:注解式认证(框架无关的概念)
|
|
48
|
+
@[你的认证注解] // 登录校验
|
|
49
|
+
@[你的权限注解]("system:user:add") // 权限校验
|
|
50
|
+
@[你的角色注解]("admin") // 角色校验
|
|
51
|
+
|
|
52
|
+
// 方式二:编程式认证
|
|
53
|
+
@RestController
|
|
54
|
+
public class UserController {
|
|
55
|
+
|
|
56
|
+
@Autowired
|
|
57
|
+
private [你的安全工具类] securityUtils;
|
|
58
|
+
|
|
59
|
+
@GetMapping("/profile")
|
|
60
|
+
public Result<?> profile() {
|
|
61
|
+
// 获取当前登录用户
|
|
62
|
+
Long userId = securityUtils.getCurrentUserId();
|
|
63
|
+
String username = securityUtils.getCurrentUsername();
|
|
64
|
+
boolean isAdmin = securityUtils.hasRole("admin");
|
|
65
|
+
boolean hasPerm = securityUtils.hasPermission("system:user:list");
|
|
66
|
+
|
|
67
|
+
if (!securityUtils.isAuthenticated()) {
|
|
68
|
+
throw new [你的异常类]("未登录");
|
|
69
|
+
}
|
|
70
|
+
// ...
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 2. 授权模型(RBAC)
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
用户 (User)
|
|
79
|
+
└── 角色 (Role) -- 多对多
|
|
80
|
+
└── 权限 (Permission) -- 多对多
|
|
81
|
+
└── 菜单/按钮/API
|
|
82
|
+
|
|
83
|
+
权限标识格式:模块:资源:操作
|
|
84
|
+
示例:system:user:add, order:info:export
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```java
|
|
88
|
+
// 多权限校验(满足其一 / 全部满足)
|
|
89
|
+
@RequiresPermissions(value = {"system:user:add", "system:user:edit"}, logical = Logical.OR)
|
|
90
|
+
@RequiresPermissions(value = {"system:user:add", "system:user:edit"}, logical = Logical.AND)
|
|
91
|
+
|
|
92
|
+
// 多角色校验
|
|
93
|
+
@RequiresRoles(value = {"admin", "editor"}, logical = Logical.OR)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 3. 输入校验
|
|
97
|
+
|
|
98
|
+
```java
|
|
99
|
+
public class UserDTO {
|
|
100
|
+
@NotNull(message = "ID不能为空", groups = {UpdateGroup.class})
|
|
101
|
+
private Long id;
|
|
102
|
+
|
|
103
|
+
@NotBlank(message = "用户名不能为空")
|
|
104
|
+
@Size(min = 2, max = 20, message = "用户名长度2-20")
|
|
105
|
+
@Pattern(regexp = "^[a-zA-Z0-9_]+$", message = "只能包含字母数字下划线")
|
|
106
|
+
private String username;
|
|
107
|
+
|
|
108
|
+
@Email(message = "邮箱格式不正确")
|
|
109
|
+
private String email;
|
|
110
|
+
|
|
111
|
+
@Min(value = 0, message = "年龄不能为负")
|
|
112
|
+
@Max(value = 150, message = "年龄超出范围")
|
|
113
|
+
private Integer age;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Controller 分组校验
|
|
117
|
+
@PostMapping
|
|
118
|
+
public Result<?> add(@Validated(AddGroup.class) @RequestBody UserDTO dto) { }
|
|
119
|
+
|
|
120
|
+
@PutMapping
|
|
121
|
+
public Result<?> update(@Validated(UpdateGroup.class) @RequestBody UserDTO dto) { }
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 4. 越权访问防护
|
|
125
|
+
|
|
126
|
+
```java
|
|
127
|
+
public [你的VO类] selectById(Long id) {
|
|
128
|
+
var entity = baseMapper.selectById(id);
|
|
129
|
+
if (entity == null) {
|
|
130
|
+
throw new [你的异常类]("数据不存在");
|
|
131
|
+
}
|
|
132
|
+
// 非管理员只能访问自己的数据
|
|
133
|
+
Long currentUserId = [你的安全工具类].getCurrentUserId();
|
|
134
|
+
if (![你的安全工具类].isAdmin() && !entity.getCreatedBy().equals(currentUserId)) {
|
|
135
|
+
throw new [你的异常类]("无权访问此数据");
|
|
136
|
+
}
|
|
137
|
+
return convertToVo(entity);
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## 常见漏洞防护
|
|
144
|
+
|
|
145
|
+
### SQL 注入
|
|
146
|
+
|
|
147
|
+
```java
|
|
148
|
+
// 禁止:字符串拼接 SQL
|
|
149
|
+
"SELECT * FROM user WHERE name = '" + name + "'"
|
|
150
|
+
@Select("SELECT * FROM user WHERE name = '${name}'")
|
|
151
|
+
|
|
152
|
+
// 正确:参数化查询
|
|
153
|
+
@Select("SELECT * FROM user WHERE name = #{name}")
|
|
154
|
+
// 或使用 ORM 框架的 QueryWrapper / LambdaQueryWrapper
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### XSS 防护
|
|
158
|
+
|
|
159
|
+
```java
|
|
160
|
+
// 方式一:全局 Filter(推荐)
|
|
161
|
+
@Bean
|
|
162
|
+
public FilterRegistrationBean<XssFilter> xssFilter() {
|
|
163
|
+
FilterRegistrationBean<XssFilter> registration = new FilterRegistrationBean<>();
|
|
164
|
+
registration.setFilter(new XssFilter());
|
|
165
|
+
registration.addUrlPatterns("/*");
|
|
166
|
+
registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
|
|
167
|
+
return registration;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// 方式二:手动转义
|
|
171
|
+
String safe = HtmlUtils.htmlEscape(userInput);
|
|
172
|
+
String safe = StringEscapeUtils.escapeHtml4(userInput);
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### 敏感信息泄露
|
|
176
|
+
|
|
177
|
+
```java
|
|
178
|
+
// 禁止:直接返回 Entity(可能包含密码等)
|
|
179
|
+
return userDao.getById(id);
|
|
180
|
+
|
|
181
|
+
// 正确:使用 VO 过滤 + @Sensitive 脱敏
|
|
182
|
+
UserVo vo = new UserVo();
|
|
183
|
+
BeanUtils.copyProperties(user, vo);
|
|
184
|
+
return vo;
|
|
185
|
+
|
|
186
|
+
// 日志脱敏
|
|
187
|
+
log.info("手机号: {}", DesensitizedUtil.mobilePhone(phone));
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## 安全检查清单
|
|
193
|
+
|
|
194
|
+
### 代码审查
|
|
195
|
+
|
|
196
|
+
- [ ] 用户输入经过 `@NotBlank` / `@Size` / `@Pattern` 校验
|
|
197
|
+
- [ ] SQL 使用参数化查询(`#{}` 而非 `${}`)
|
|
198
|
+
- [ ] 敏感字段使用脱敏注解或 VO 过滤
|
|
199
|
+
- [ ] 存储敏感数据使用加密
|
|
200
|
+
- [ ] Controller 添加权限注解
|
|
201
|
+
- [ ] 写入接口添加防重复提交
|
|
202
|
+
- [ ] 高频接口添加限流
|
|
203
|
+
- [ ] 批量操作校验数据归属(防越权)
|
|
204
|
+
- [ ] 文件上传校验类型 / 大小 / 扩展名(白名单)
|
|
205
|
+
- [ ] 日志中无敏感信息(或已脱敏)
|
|
206
|
+
|
|
207
|
+
### 配置与部署
|
|
208
|
+
|
|
209
|
+
- [ ] 生产环境关闭调试模式、Swagger
|
|
210
|
+
- [ ] 敏感配置使用环境变量或配置中心加密
|
|
211
|
+
- [ ] Token 有效期合理(2-24h)
|
|
212
|
+
- [ ] CORS 不使用 `*`,限定域名
|
|
213
|
+
- [ ] 启用 HTTPS
|
|
214
|
+
- [ ] 设置安全响应头(X-Frame-Options、X-Content-Type-Options、CSP)
|
|
215
|
+
- [ ] 错误页不泄露堆栈信息
|
|
216
|
+
- [ ] 数据库 / Redis 端口不对外暴露
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## 常见错误
|
|
221
|
+
|
|
222
|
+
```java
|
|
223
|
+
// 1. 忘记加认证注解,接口裸奔
|
|
224
|
+
@GetMapping("/users")
|
|
225
|
+
public Result<?> list() { ... } // 任何人可访问!
|
|
226
|
+
|
|
227
|
+
// 2. 只校验前端,不校验后端
|
|
228
|
+
// 前端限制了输入范围,但后端不做校验 -> 可被绕过
|
|
229
|
+
|
|
230
|
+
// 3. 用 Map 传递用户信息(类型不安全)
|
|
231
|
+
Map<String, Object> user = getCurrentUser(); // 缺乏类型约束
|
|
232
|
+
// 应使用强类型 LoginUser 对象
|
|
233
|
+
|
|
234
|
+
// 4. 密码明文存储
|
|
235
|
+
user.setPassword(rawPassword);
|
|
236
|
+
// 应使用 BCrypt / SCrypt 哈希
|
|
237
|
+
user.setPassword(passwordEncoder.encode(rawPassword));
|
|
238
|
+
|
|
239
|
+
// 5. Token 存储敏感信息
|
|
240
|
+
// JWT payload 不应包含密码、完整身份证号等
|
|
241
|
+
|
|
242
|
+
// 6. CORS 配置过于宽松
|
|
243
|
+
.allowedOrigins("*").allowedMethods("*").allowCredentials(true)
|
|
244
|
+
// allowedOrigins("*") 与 allowCredentials(true) 不能同时使用
|
|
245
|
+
```
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# 数据加密详细配置
|
|
2
|
+
|
|
3
|
+
## 加密配置(application.yml)
|
|
4
|
+
|
|
5
|
+
```yaml
|
|
6
|
+
mybatis-encryptor:
|
|
7
|
+
enable: true
|
|
8
|
+
algorithm: AES
|
|
9
|
+
password: your-aes-key-16bit # AES 密钥(16/24/32位)
|
|
10
|
+
encode: BASE64
|
|
11
|
+
publicKey: xxx # RSA 公钥
|
|
12
|
+
privateKey: xxx # RSA 私钥
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## EncryptUtils 工具类
|
|
16
|
+
|
|
17
|
+
```java
|
|
18
|
+
import org.dromara.common.encrypt.utils.EncryptUtils;
|
|
19
|
+
|
|
20
|
+
// AES
|
|
21
|
+
String encrypted = EncryptUtils.encryptByAes(data, aesKey);
|
|
22
|
+
String decrypted = EncryptUtils.decryptByAes(encrypted, aesKey);
|
|
23
|
+
|
|
24
|
+
// RSA(公钥加密,私钥解密)
|
|
25
|
+
String encrypted = EncryptUtils.encryptByRsa(data, publicKey);
|
|
26
|
+
String decrypted = EncryptUtils.decryptByRsa(encrypted, privateKey);
|
|
27
|
+
|
|
28
|
+
// SM2 国密
|
|
29
|
+
String encrypted = EncryptUtils.encryptBySm2(data, publicKey);
|
|
30
|
+
String decrypted = EncryptUtils.decryptBySm2(encrypted, privateKey);
|
|
31
|
+
|
|
32
|
+
// SM4 国密
|
|
33
|
+
String encrypted = EncryptUtils.encryptBySm4(data, sm4Key);
|
|
34
|
+
String decrypted = EncryptUtils.decryptBySm4(encrypted, sm4Key);
|
|
35
|
+
|
|
36
|
+
// BASE64
|
|
37
|
+
String encoded = EncryptUtils.encryptByBase64(data);
|
|
38
|
+
String decoded = EncryptUtils.decryptByBase64(encoded);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 字段加密完整示例
|
|
42
|
+
|
|
43
|
+
```java
|
|
44
|
+
import org.dromara.common.encrypt.annotation.EncryptField;
|
|
45
|
+
import org.dromara.common.encrypt.enumd.AlgorithmType;
|
|
46
|
+
import org.dromara.common.encrypt.enumd.EncodeType;
|
|
47
|
+
|
|
48
|
+
public class User {
|
|
49
|
+
@EncryptField // 使用全局配置
|
|
50
|
+
private String password;
|
|
51
|
+
|
|
52
|
+
@EncryptField(algorithm = AlgorithmType.AES) // AES
|
|
53
|
+
private String idCard;
|
|
54
|
+
|
|
55
|
+
@EncryptField(algorithm = AlgorithmType.SM4) // SM4
|
|
56
|
+
private String phone;
|
|
57
|
+
|
|
58
|
+
@EncryptField(algorithm = AlgorithmType.AES, encode = EncodeType.HEX) // AES + HEX 编码
|
|
59
|
+
private String bankCard;
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## @RateLimiter 注解参数
|
|
64
|
+
|
|
65
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
66
|
+
|------|------|--------|------|
|
|
67
|
+
| `key` | String | `""` | 限流 key,支持 SpEL |
|
|
68
|
+
| `time` | int | `60` | 时间窗口(秒) |
|
|
69
|
+
| `count` | int | `100` | 最大请求次数 |
|
|
70
|
+
| `limitType` | LimitType | `DEFAULT` | 限流类型(DEFAULT/IP/CLUSTER) |
|
|
71
|
+
| `message` | String | 国际化 key | 错误提示 |
|
|
72
|
+
| `timeout` | int | `86400` | Redis 超时时间(秒) |
|
|
73
|
+
|
|
74
|
+
## @RepeatSubmit 注解参数
|
|
75
|
+
|
|
76
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
77
|
+
|------|------|--------|------|
|
|
78
|
+
| `interval` | int | `5000` | 间隔时间 |
|
|
79
|
+
| `timeUnit` | TimeUnit | `MILLISECONDS` | 时间单位 |
|
|
80
|
+
| `message` | String | 国际化 key | 错误提示 |
|
|
81
|
+
|
|
82
|
+
## 文件上传安全模板
|
|
83
|
+
|
|
84
|
+
```java
|
|
85
|
+
private static final Set<String> ALLOWED_TYPES = Set.of(
|
|
86
|
+
"image/jpeg", "image/png", "image/gif", "image/webp"
|
|
87
|
+
);
|
|
88
|
+
private static final long MAX_FILE_SIZE = 10 * 1024 * 1024; // 10MB
|
|
89
|
+
|
|
90
|
+
public void uploadFile(MultipartFile file) {
|
|
91
|
+
if (!ALLOWED_TYPES.contains(file.getContentType())) {
|
|
92
|
+
throw new ServiceException("不支持的文件类型");
|
|
93
|
+
}
|
|
94
|
+
if (file.getSize() > MAX_FILE_SIZE) {
|
|
95
|
+
throw new ServiceException("文件大小不能超过10MB");
|
|
96
|
+
}
|
|
97
|
+
String extension = getExtension(file.getOriginalFilename());
|
|
98
|
+
if (!Set.of(".jpg", ".jpeg", ".png", ".gif", ".webp").contains(extension.toLowerCase())) {
|
|
99
|
+
throw new ServiceException("不支持的文件扩展名");
|
|
100
|
+
}
|
|
101
|
+
String newName = UUID.randomUUID() + extension; // 重命名防路径穿越
|
|
102
|
+
}
|
|
103
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# 数据脱敏策略完整列表(17种)
|
|
2
|
+
|
|
3
|
+
> 来源:`ruoyi-common-sensitive/.../core/SensitiveStrategy`
|
|
4
|
+
|
|
5
|
+
| 策略 | 枚举值 | 脱敏效果 | 说明 |
|
|
6
|
+
|------|--------|---------|------|
|
|
7
|
+
| 身份证 | `ID_CARD` | `110***********1234` | 保留前3位和后4位 |
|
|
8
|
+
| 手机号 | `PHONE` | `138****8888` | 保留前3位和后4位 |
|
|
9
|
+
| 邮箱 | `EMAIL` | `t**@example.com` | 保留用户名首尾和完整域名 |
|
|
10
|
+
| 银行卡 | `BANK_CARD` | `6222***********1234` | 保留前4位和后4位 |
|
|
11
|
+
| 中文姓名 | `CHINESE_NAME` | `张*` | 保留姓氏 |
|
|
12
|
+
| 地址 | `ADDRESS` | `北京市朝阳区****` | 保留前8个字符 |
|
|
13
|
+
| 固定电话 | `FIXED_PHONE` | `010****1234` | 保留区号和后4位 |
|
|
14
|
+
| 密码 | `PASSWORD` | `******` | 全部掩码 |
|
|
15
|
+
| IPv4 地址 | `IPV4` | `192.168.***.***` | 保留网络段 |
|
|
16
|
+
| IPv6 地址 | `IPV6` | 部分隐藏 | 保留前缀 |
|
|
17
|
+
| 车牌号 | `CAR_LICENSE` | `京A***12` | 支持普通和新能源 |
|
|
18
|
+
| 用户ID | `USER_ID` | 随机数字 | 生成随机数字替代 |
|
|
19
|
+
| 首字符保留 | `FIRST_MASK` | `张***` | 只显示第一个字符 |
|
|
20
|
+
| 通用掩码 | `STRING_MASK` | `1234**7890` | 前4+4个*+后4 |
|
|
21
|
+
| 高安全级别 | `MASK_HIGH_SECURITY` | `to******en` | 前2后2可见 |
|
|
22
|
+
| 清空 | `CLEAR` | 空字符串 | 返回空字符串 |
|
|
23
|
+
| 置空 | `CLEAR_TO_NULL` | `null` | 返回 null |
|
|
24
|
+
|
|
25
|
+
## 用法示例
|
|
26
|
+
|
|
27
|
+
```java
|
|
28
|
+
@Sensitive(strategy = SensitiveStrategy.PHONE)
|
|
29
|
+
private String phone;
|
|
30
|
+
|
|
31
|
+
@Sensitive(strategy = SensitiveStrategy.ID_CARD)
|
|
32
|
+
private String idCard;
|
|
33
|
+
|
|
34
|
+
@Sensitive(strategy = SensitiveStrategy.ADDRESS)
|
|
35
|
+
private String address;
|
|
36
|
+
|
|
37
|
+
@Sensitive(strategy = SensitiveStrategy.IPV4)
|
|
38
|
+
private String loginIp;
|
|
39
|
+
|
|
40
|
+
@Sensitive(strategy = SensitiveStrategy.CAR_LICENSE)
|
|
41
|
+
private String carNumber;
|
|
42
|
+
```
|