From 2757a4fb496530e0bab79ffa93be5cf02afbd6cd Mon Sep 17 00:00:00 2001 From: gin Date: Fri, 15 May 2026 09:19:09 +0800 Subject: [PATCH] feat: collaboration and statistics --- frontend/.editorconfig => .editorconfig | 2 +- .gitignore | 71 +++ .vscode/extensions.json | 12 + .../web/.vscode => .vscode}/settings.json | 41 +- AGENTS.md | 15 + README.md | 29 +- backend/.github/ISSUE_TEMPLATE/bug_report.md | 36 -- .../.github/ISSUE_TEMPLATE/feature_request.md | 20 - backend/.github/workflows/ci-cd.yml | 116 ---- backend/.gitignore | 50 -- backend/GoogleStyle.xml | 4 +- .../CollaborationRecordController.java | 104 ++++ .../src/main/resources/application-dev.yml | 10 +- .../admin/config/AgileBootConfigTest.java | 15 +- .../utils/file/FileUploadUtilsTest.java | 4 +- ...CollaborationRecordApplicationService.java | 402 +++++++++++++ .../AddCollaborationRecordCommand.java | 83 +++ .../CollaborationExpenditureCommand.java | 25 + .../command/CollaborationFileCommand.java | 30 + .../CollaborationSettlementCommand.java | 28 + .../command/CollaborationTaskCommand.java | 16 + .../UpdateCollaborationRecordCommand.java | 19 + .../db/CollaborationExpenditureEntity.java | 46 ++ .../db/CollaborationExpenditureMapper.java | 10 + .../db/CollaborationExpenditureService.java | 16 + .../CollaborationExpenditureServiceImpl.java | 36 ++ .../record/db/CollaborationFileEntity.java | 51 ++ .../record/db/CollaborationFileMapper.java | 10 + .../record/db/CollaborationFileService.java | 16 + .../db/CollaborationFileServiceImpl.java | 36 ++ .../record/db/CollaborationRecordEntity.java | 100 ++++ .../record/db/CollaborationRecordMapper.java | 10 + .../record/db/CollaborationRecordService.java | 10 + .../db/CollaborationRecordServiceImpl.java | 14 + .../db/CollaborationSettlementEntity.java | 49 ++ .../db/CollaborationSettlementMapper.java | 10 + .../db/CollaborationSettlementService.java | 16 + .../CollaborationSettlementServiceImpl.java | 36 ++ .../record/db/CollaborationTaskEntity.java | 42 ++ .../record/db/CollaborationTaskMapper.java | 10 + .../record/db/CollaborationTaskService.java | 16 + .../db/CollaborationTaskServiceImpl.java | 36 ++ .../dto/CollaborationExpenditureDTO.java | 33 ++ .../record/dto/CollaborationFileDTO.java | 35 ++ .../CollaborationMonthlyStatisticsDTO.java | 26 + .../record/dto/CollaborationOptionDTO.java | 22 + .../record/dto/CollaborationRecordDTO.java | 71 +++ .../dto/CollaborationRecordDetailDTO.java | 30 + .../dto/CollaborationSettlementDTO.java | 35 ++ .../record/dto/CollaborationTaskDTO.java | 30 + .../record/dto/SettlementStatusDTO.java | 19 + .../enumtype/CollaborationFileTypeEnum.java | 12 + .../enumtype/CollaborationOptionEnum.java | 45 ++ .../record/enumtype/SettlementStatusEnum.java | 27 + .../model/CollaborationRecordModel.java | 79 +++ .../CollaborationRecordModelFactory.java | 31 + .../query/CollaborationRecordQuery.java | 49 ++ backend/bin/ag-admin.bat | 67 --- backend/bin/ag-admin.sh | 86 --- backend/bin/run.bat | 14 - backend/docker-compose.yml | 28 +- backend/mvnw | 0 .../{agileboot-20230814.sql => agileboot.sql} | 248 ++++++-- backend/sql/agileboot_20221007.sql | 428 -------------- docs/backend-feature-development.md | 155 +++++ docs/clean-code-contract.md | 275 +++++++++ docs/web-feature-development.md | 198 +++++++ frontend/.prettierrc.cjs | 2 +- frontend/app/.gitignore | 8 - frontend/pnpm-lock.yaml | 29 + frontend/pnpm-workspace.yaml | 11 +- frontend/web/.gitignore | 24 - frontend/web/.vscode/extensions.json | 31 - frontend/web/.vscode/vue3.0.code-snippets | 22 - frontend/web/.vscode/vue3.2.code-snippets | 17 - frontend/web/.vscode/vue3.3.code-snippets | 20 - frontend/web/package.json | 1 + frontend/web/src/api/collaboration/record.ts | 206 +++++++ .../web/src/components/ReDialog/index.vue | 1 + .../web/src/components/VDialog/VDialog.vue | 8 +- .../layout/components/sidebar/sidebarItem.vue | 6 +- frontend/web/src/style/element-plus.scss | 27 + .../src/views/collaboration/record/index.vue | 238 ++++++++ .../record/record-form-modal.vue | 558 ++++++++++++++++++ .../views/collaboration/record/utils/hook.tsx | 241 ++++++++ .../views/collaboration/statistics/index.vue | 48 ++ .../collaboration/statistics/utils/hook.ts | 84 +++ frontend/web/src/views/system/post/index.vue | 73 ++- .../src/views/system/post/post-form-modal.vue | 136 ++--- frontend/web/src/views/system/role/index.vue | 92 ++- .../src/views/system/role/role-form-modal.vue | 177 ++---- 91 files changed, 4504 insertions(+), 1301 deletions(-) rename frontend/.editorconfig => .editorconfig (94%) create mode 100644 .gitignore create mode 100644 .vscode/extensions.json rename {frontend/web/.vscode => .vscode}/settings.json (53%) create mode 100644 AGENTS.md delete mode 100644 backend/.github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 backend/.github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 backend/.github/workflows/ci-cd.yml delete mode 100644 backend/.gitignore create mode 100644 backend/agileboot-admin/src/main/java/com/agileboot/admin/controller/collaboration/CollaborationRecordController.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/CollaborationRecordApplicationService.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/command/AddCollaborationRecordCommand.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/command/CollaborationExpenditureCommand.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/command/CollaborationFileCommand.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/command/CollaborationSettlementCommand.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/command/CollaborationTaskCommand.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/command/UpdateCollaborationRecordCommand.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationExpenditureEntity.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationExpenditureMapper.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationExpenditureService.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationExpenditureServiceImpl.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationFileEntity.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationFileMapper.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationFileService.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationFileServiceImpl.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationRecordEntity.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationRecordMapper.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationRecordService.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationRecordServiceImpl.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationSettlementEntity.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationSettlementMapper.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationSettlementService.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationSettlementServiceImpl.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationTaskEntity.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationTaskMapper.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationTaskService.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/db/CollaborationTaskServiceImpl.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/dto/CollaborationExpenditureDTO.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/dto/CollaborationFileDTO.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/dto/CollaborationMonthlyStatisticsDTO.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/dto/CollaborationOptionDTO.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/dto/CollaborationRecordDTO.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/dto/CollaborationRecordDetailDTO.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/dto/CollaborationSettlementDTO.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/dto/CollaborationTaskDTO.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/dto/SettlementStatusDTO.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/enumtype/CollaborationFileTypeEnum.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/enumtype/CollaborationOptionEnum.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/enumtype/SettlementStatusEnum.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/model/CollaborationRecordModel.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/model/CollaborationRecordModelFactory.java create mode 100644 backend/agileboot-domain/src/main/java/com/agileboot/domain/collaboration/record/query/CollaborationRecordQuery.java delete mode 100644 backend/bin/ag-admin.bat delete mode 100644 backend/bin/ag-admin.sh delete mode 100644 backend/bin/run.bat mode change 100644 => 100755 backend/mvnw rename backend/sql/{agileboot-20230814.sql => agileboot.sql} (76%) delete mode 100644 backend/sql/agileboot_20221007.sql create mode 100644 docs/backend-feature-development.md create mode 100644 docs/clean-code-contract.md create mode 100644 docs/web-feature-development.md delete mode 100644 frontend/app/.gitignore delete mode 100644 frontend/web/.gitignore delete mode 100644 frontend/web/.vscode/extensions.json delete mode 100644 frontend/web/.vscode/vue3.0.code-snippets delete mode 100644 frontend/web/.vscode/vue3.2.code-snippets delete mode 100644 frontend/web/.vscode/vue3.3.code-snippets create mode 100644 frontend/web/src/api/collaboration/record.ts create mode 100644 frontend/web/src/views/collaboration/record/index.vue create mode 100644 frontend/web/src/views/collaboration/record/record-form-modal.vue create mode 100644 frontend/web/src/views/collaboration/record/utils/hook.tsx create mode 100644 frontend/web/src/views/collaboration/statistics/index.vue create mode 100644 frontend/web/src/views/collaboration/statistics/utils/hook.ts diff --git a/frontend/.editorconfig b/.editorconfig similarity index 94% rename from frontend/.editorconfig rename to .editorconfig index fbace8d..0880aa5 100644 --- a/frontend/.editorconfig +++ b/.editorconfig @@ -5,6 +5,7 @@ root = true charset = utf-8 indent_style = space indent_size = 2 +tab_width = 2 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true @@ -12,4 +13,3 @@ trim_trailing_whitespace = true [*.md] insert_final_newline = false trim_trailing_whitespace = false - diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b1d7852 --- /dev/null +++ b/.gitignore @@ -0,0 +1,71 @@ +# Common +.DS_Store +.idea/ +*.iws +*.iml +*.ipr +*.suo +*.ntvs* +*.njsproj +*.sln +*.log +*.swp + +# Frontend workspace +/frontend/**/node_modules/ +/frontend/**/.eslintcache +/frontend/**/tsconfig.tsbuildinfo +/frontend/**/*.local + +# Frontend app +/frontend/app/dist/ +/frontend/app/deploy_versions/ +/frontend/app/.temp/ +/frontend/app/.rn_temp/ +/frontend/app/.swc + +# Frontend web +/frontend/web/dist/ +/frontend/web/dist-ssr/ +/frontend/web/report.html +/frontend/web/yarn.lock +/frontend/web/npm-debug.log* +/frontend/web/.pnpm-error.log* +/frontend/web/.pnpm-debug.log +/frontend/web/tests/**/coverage/ +/frontend/web/.vscode/launch.json + +# Backend build tools +/backend/.gradle/ +/backend/build/ +!/backend/gradle/wrapper/gradle-wrapper.jar +/backend/**/target/ +!/backend/.mvn/wrapper/maven-wrapper.jar + +# Backend IDE +/backend/**/.apt_generated +/backend/**/.classpath +/backend/**/.factorypath +/backend/**/.project +/backend/**/.settings/ +/backend/**/.springBeans + +# Backend JRebel +/backend/**/rebel.xml + +# Backend NetBeans +/backend/nbproject/private/ +/backend/build/* +/backend/nbbuild/ +/backend/dist/ +/backend/nbdist/ +/backend/.nb-gradle/ + +# Backend generated files +/backend/**/*.xml.versionsBackup +!/backend/*/build/*.java +!/backend/*/build/*.html +!/backend/*/build/*.xml + +# Backend local configuration +/backend/agileboot-admin/src/main/resources/application-prod.yml diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..e70e633 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,12 @@ +{ + "recommendations": [ + "EditorConfig.EditorConfig", + "esbenp.prettier-vscode", + "dbaeumer.vscode-eslint", + "stylelint.vscode-stylelint", + "Vue.volar", + "bradlc.vscode-tailwindcss", + "mikestead.dotenv", + "antfu.iconify" + ] +} diff --git a/frontend/web/.vscode/settings.json b/.vscode/settings.json similarity index 53% rename from frontend/web/.vscode/settings.json rename to .vscode/settings.json index 9b434de..2e05277 100644 --- a/frontend/web/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,32 +1,43 @@ { - "editor.formatOnType": true, - "editor.formatOnSave": true, - "[vue]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, + "editor.detectIndentation": false, "editor.tabSize": 2, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, "editor.formatOnPaste": true, + "editor.formatOnType": true, "editor.guides.bracketPairs": "active", - "files.autoSave": "afterDelay", - "git.confirmSync": false, - "workbench.startupEditor": "newUntitledFile", + "editor.snippetSuggestions": "top", "editor.suggestSelection": "first", "editor.acceptSuggestionOnCommitCharacter": false, - "css.lint.propertyIgnoredDueToDisplay": "ignore", "editor.quickSuggestions": { "other": true, "comments": true, "strings": true }, - "files.associations": { - "editor.snippetSuggestions": "top" + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit", + "source.fixAll.stylelint": "explicit" + }, + "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "vue"], + "stylelint.validate": ["css", "scss", "vue"], + "[vue]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[css]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, - "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "[scss]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" }, - "iconify.excludes": ["el"], - "cSpell.words": ["iconify", "Qrcode"] + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "css.lint.propertyIgnoredDueToDisplay": "ignore", + "files.autoSave": "afterDelay", + "git.confirmSync": false, + "workbench.startupEditor": "newUntitledFile", + "iconify.excludes": ["el"] } diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..4f85cd9 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,15 @@ +# Agent Rules + +- 新增或修改代码前,必须阅读并遵循 `docs/clean-code-contract.md`。 +- 后端新增或修改业务功能前,必须阅读 `docs/backend-feature-development.md`。 +- 后端代码必须遵循 `Controller -> ApplicationService -> Model -> db Service/Mapper` 的组织方式。 +- 不要把业务规则写在 Controller。 +- 不要让 Controller 直接调用 Mapper。 +- 不要直接把 Entity 或 DO 返回给前端。 +- 复杂查询结果对象可以使用 `XxxDO`,放在 `db` 包下,并由 ApplicationService 转换为 DTO。 +- 字典类需求不要默认创建字典管理表;本项目现有字典数据使用 Enum 和缓存。 +- `frontend/web` 新增或修改业务功能前,必须阅读 `docs/web-feature-development.md`。 +- Web 前端接口必须通过 `@/utils/http` 封装调用,不要直接使用 Axios。 +- Web 列表页复杂状态和行为应放在 `utils/hook.tsx`,不要堆在 `index.vue`。 +- Web 页面私有组件放在当前模块的 `components/`,多模块复用组件提升到 `frontend/web/src/components`。 +- Web 字典展示优先使用 `useUserStoreHook().dictionaryList` 或 `dictionaryMap`,不要硬编码状态文本和值。 diff --git a/README.md b/README.md index cae1036..6c9afb8 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,31 @@ cd backend docker compose up -d ``` -On a fresh Docker volume, Compose creates the MySQL database `agileboot_pure`. -Import the SQL files under `backend/sql/` before starting the backend. +The compose configuration mounts `backend/sql/agileboot.sql` into the MySQL +container as `/docker-entrypoint-initdb.d/01-agileboot.sql`. +The official MySQL image only runs files in `/docker-entrypoint-initdb.d` when +the database directory is empty, during the first initialization of the +`mysql_data` volume. + +If MySQL has already been started before, the `mysql_data` volume already +contains data and `docker compose up -d` will not import the SQL again. To +reinitialize the local database, remove the volumes first: + +```bash +cd backend +docker compose down -v +docker compose up -d +``` + +Warning: `docker compose down -v` deletes the local MySQL and Redis volumes, +including existing database data and Redis data. + +If you do not want to delete the volumes, import the SQL manually: + +```bash +cd backend +docker exec -i mysql-server mysql -uroot -proot123 agileboot_pure < sql/agileboot.sql +``` ### Install Frontend Dependencies @@ -50,7 +73,7 @@ Start the backend: ```bash cd backend -./mvnw -pl agileboot-admin -am spring-boot:run +./mvnw -pl agileboot-admin spring-boot:run ``` Start the web frontend: diff --git a/backend/.github/ISSUE_TEMPLATE/bug_report.md b/backend/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index ab0e815..0000000 --- a/backend/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -name: Bug 报告 -about: 创建BUG报告以改进项目 -title: '' -labels: '' -assignees: '' - ---- - -**BUG描述** -关于BUG清晰简洁的描述。 - -**复现步骤** -详细的复现步骤。 - - -**正确的行为** -你认为这个修复这个BUG后,正确的行为应该是什么。 - - -**详细截图** -如果可以的话,请添加截图以帮助调查BUG. - -**桌面端:** - - 操作系统: [例如. iOS] - - 浏览器及版本 [例如. chrome 11] - - 项目版本 [例如. 1.6.0] - -**手机端:** - - 设备: [例如. iPhone6] - - 操作系统: [例如. iOS8.1] - - 浏览器及版本 [例如.safari 8] - - 项目版本 [例如. 1.6.0] - -**Additional context** -任何其他你认为有助于排查错误的信息,或者你的猜测。 diff --git a/backend/.github/ISSUE_TEMPLATE/feature_request.md b/backend/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 913a980..0000000 --- a/backend/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: 功能建议 -about: 关于该项目的建议 -title: '' -labels: '' -assignees: '' - ---- - -**您的功能请求是否与问题相关? 请描述。** -清楚简明地描述问题所在。 - -**描述您想要的解决方案** -对您所设想的问题的清晰简洁的描述。 - -**描述您考虑过的替代方案** -对您考虑过的任何替代解决方案或功能的清晰简洁的描述。 - -**附加上下文** -在此处添加有关功能请求的任何其他上下文或屏幕截图。 diff --git a/backend/.github/workflows/ci-cd.yml b/backend/.github/workflows/ci-cd.yml deleted file mode 100644 index 4a7a5a7..0000000 --- a/backend/.github/workflows/ci-cd.yml +++ /dev/null @@ -1,116 +0,0 @@ -# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven - -# 权限声明,确保 workflow 有权限写 checks 和 security-events -permissions: - contents: read - checks: write - security-events: write - -name: Java CI with Maven - -on: - push: - branches: [ "main" ] - paths-ignore: - - 'README.md' - - 'LICENSE' - - '.gitignore' - - '.gitattributes' - - 'picture' - pull_request: - branches: [ "main" ] - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - timeout-minutes: 30 - strategy: - matrix: - java-version: ['8', '17', '21'] - fail-fast: false - - name: Build with Java ${{ matrix.java-version }} - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up JDK ${{ matrix.java-version }} - uses: actions/setup-java@v3 - with: - java-version: ${{ matrix.java-version }} - distribution: 'temurin' - cache: 'maven' - - # 优化Maven本地仓库缓存策略 - - name: Cache Maven packages - uses: actions/cache@v3 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}-${{ matrix.java-version }} - restore-keys: | - ${{ runner.os }}-m2- - - # 编译和测试:去掉failOnWarning,避免因为警告导致失败 - - name: Build and Test with Maven - run: | - mvn -B verify --file pom.xml -Dmaven.test.failure.ignore=false -Dgpg.skip -Dmaven.javadoc.skip=false - env: - MAVEN_OPTS: -Xmx4g -XX:MaxMetaspaceSize=1g - MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version" - - - name: Publish Test Report - uses: mikepenz/action-junit-report@v4 - if: success() || failure() - with: - report_paths: '**/target/surefire-reports/TEST-*.xml' - detailed_summary: true - include_passed: true - fail_on_failure: true - - - name: Run SonarQube Analysis - if: matrix.java-version == '17' && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' - continue-on-error: true - run: | - if [[ ! -z "${{ secrets.SONAR_TOKEN }}" ]]; then - mvn sonar:sonar \ - -Dsonar.projectKey=agileboot \ - -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION || 'default' }} \ - -Dsonar.host.url=${{ secrets.SONAR_HOST_URL || 'https://sonarcloud.io' }} \ - -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ - -Dsonar.java.source=${{ matrix.java-version }} - else - echo "Skipping SonarQube analysis - SONAR_TOKEN not configured" - fi - - # 上传构建产物,if-no-files-found 改为 warn - - name: Upload Build Artifacts - uses: actions/upload-artifact@v4 - with: - name: agileboot-artifacts-java-${{ matrix.java-version }} - path: | - **/target/*.jar - !**/target/original-*.jar - retention-days: 5 - if-no-files-found: warn - - # # 只在 Java 17 版本上更新依赖图(权限和token已修复) - # - name: Update dependency graph - # uses: advanced-security/maven-dependency-submission-action@v4 - # if: matrix.java-version == '17' && success() - # with: - # token: ${{ secrets.GITHUB_TOKEN }} - - # # 发送构建状态通知 - # - name: Notify Build Status - # if: always() - # uses: rtCamp/action-slack-notify@v2.2.1 - # env: - # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK || '' }} - # SLACK_CHANNEL: build-notifications - # SLACK_COLOR: ${{ job.status }} - # SLACK_TITLE: Build Status for Java ${{ matrix.java-version }} - # SLACK_MESSAGE: 'Build ${{ job.status }} on Java ${{ matrix.java-version }}' \ No newline at end of file diff --git a/backend/.gitignore b/backend/.gitignore deleted file mode 100644 index f6e0209..0000000 --- a/backend/.gitignore +++ /dev/null @@ -1,50 +0,0 @@ -###################################################################### -# Build Tools - -.gradle -/build/ -!gradle/wrapper/gradle-wrapper.jar - -target/ -!.mvn/wrapper/maven-wrapper.jar - -###################################################################### -# IDE - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### JRebel ### -rebel.xml - -### NetBeans ### -nbproject/private/ -build/* -nbbuild/ -dist/ -nbdist/ -.nb-gradle/ - -###################################################################### -# Others -*.log -*.xml.versionsBackup -*.swp - -!*/build/*.java -!*/build/*.html -!*/build/*.xml - -/agileboot-admin/src/main/resources/application-prod.yml - diff --git a/backend/GoogleStyle.xml b/backend/GoogleStyle.xml index c2e1d68..1214d64 100644 --- a/backend/GoogleStyle.xml +++ b/backend/GoogleStyle.xml @@ -148,7 +148,9 @@