Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #3179

Merged
merged 4 commits into from
Dec 22, 2024
Merged

Dev #3179

merged 4 commits into from
Dec 22, 2024

Conversation

KouShenhai
Copy link
Owner

@KouShenhai KouShenhai commented Dec 22, 2024

Summary by Sourcery

记录登录日志。

新功能:

  • 添加了记录登录日志的功能,包括用户名、IP、位置、浏览器、操作系统、状态、错误信息、登录类型和时间戳。

测试:

  • 更新了测试以涵盖新的登录日志功能。
Original summary in English

Summary by Sourcery

Record login logs.

New Features:

  • Added functionality to record login logs, including username, IP, location, browser, OS, status, error messages, login type, and timestamp.

Tests:

  • Updated tests to cover the new login log functionality.

Summary by CodeRabbit

  • New Features

    • Introduced new classes for handling login logs, including LoginLogSaveCmd, LoginLogE, and LoginLogConvertor.
    • Added functionality to publish domain events during authentication processes.
    • Enhanced event handling by adding a timestamp to the LoginEvent.
  • Bug Fixes

    • Improved error handling and logging for authentication events.
  • Refactor

    • Updated import statements for JacksonUtil across multiple classes to a new package.
    • Removed unused constants and methods to streamline the codebase.
  • Chores

    • Removed deprecated classes and methods that are no longer in use.

Copy link

coderabbitai bot commented Dec 22, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request introduces significant changes across multiple modules in the Laokou Cloud Platform, focusing on restructuring authentication, logging, and utility classes. The primary modifications include refactoring the login log handling process, moving utility classes to a new package, and updating various components to support these changes. The changes span authentication, event handling, and core utility implementations, with a particular emphasis on improving modularity and separation of concerns.

Changes

File/Module Change Summary
doc/db/kcloud_platform_generator.sql Added complete table structures for boot_generator_column, boot_generator_info, and boot_generator_template
laokou-common-core/pom.xml Removed Jackson library dependencies
laokou-common-i18n/pom.xml Added Jackson library dependencies
Authentication Modules Introduced new classes for login log handling: LoginLogE, LoginLogCO, LoginLogSaveCmd, LoginLogConvertor
Utility Classes Moved JacksonUtil from common-core to common-i18n package
Event Handling Updated domain event processing in multiple classes

Sequence Diagram

sequenceDiagram
    participant User
    participant AuthService
    participant LoginEventHandler
    participant DomainService
    participant LoginLogGateway
    participant Database

    User->>AuthService: Attempt Login
    AuthService->>LoginEventHandler: Create Login Event
    LoginEventHandler->>DomainService: Create Login Log
    DomainService->>LoginLogGateway: Save Login Log
    LoginLogGateway->>Database: Insert Login Log Record
Loading

Poem

🐰 Hopping through code with glee,
Refactoring logs, setting events free
Jackson moves, utilities dance
Authentication gets a fresh new chance
CodeRabbit's magic touches every line! 🔧

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4da193f and 2ae080d.

📒 Files selected for processing (53)
  • doc/db/kcloud_platform_generator.sql (0 hunks)
  • laokou-cloud/laokou-gateway/src/main/java/org/laokou/gateway/repository/NacosRouteDefinitionRepository.java (1 hunks)
  • laokou-cloud/laokou-nacos/src/main/java/com/alibaba/nacos/console/controller/v2/NamespaceControllerV2.java (1 hunks)
  • laokou-common/laokou-common-core/pom.xml (0 hunks)
  • laokou-common/laokou-common-core/src/main/java/org/laokou/common/core/utils/MapUtil.java (1 hunks)
  • laokou-common/laokou-common-core/src/main/java/org/laokou/common/core/utils/ResponseUtil.java (1 hunks)
  • laokou-common/laokou-common-data-cache/src/main/java/org/laokou/common/data/cache/constant/MqConstant.java (1 hunks)
  • laokou-common/laokou-common-data-cache/src/main/java/org/laokou/common/data/cache/domainevent/RemovedCacheEvent.java (1 hunks)
  • laokou-common/laokou-common-data-cache/src/main/java/org/laokou/common/data/cache/handler/RemoveCacheEventHandler.java (1 hunks)
  • laokou-common/laokou-common-domain/src/main/java/org/laokou/common/domain/config/DomainAutoConfig.java (0 hunks)
  • laokou-common/laokou-common-domain/src/main/java/org/laokou/common/domain/handler/AbstractDomainEventHandler.java (3 hunks)
  • laokou-common/laokou-common-elasticsearch/src/main/java/org/laokou/common/elasticsearch/template/ElasticsearchTemplate.java (1 hunks)
  • laokou-common/laokou-common-i18n/pom.xml (2 hunks)
  • laokou-common/laokou-common-i18n/src/main/java/org/laokou/common/i18n/common/constant/EventType.java (1 hunks)
  • laokou-common/laokou-common-i18n/src/main/java/org/laokou/common/i18n/dto/DomainEvent.java (2 hunks)
  • laokou-common/laokou-common-i18n/src/main/java/org/laokou/common/i18n/utils/JacksonUtil.java (1 hunks)
  • laokou-common/laokou-common-log/src/main/java/org/laokou/common/log/model/LogE.java (1 hunks)
  • laokou-common/laokou-common-mybatis-plus/src/main/java/org/laokou/common/mybatisplus/config/MybatisPlusAutoConfig.java (1 hunks)
  • laokou-common/laokou-common-mybatis-plus/src/main/java/org/mybatis/spring/MyBatisExceptionTranslator.java (2 hunks)
  • laokou-common/laokou-common-nacos/src/main/java/org/laokou/common/nacos/utils/ReactiveResponseUtil.java (1 hunks)
  • laokou-common/laokou-common-rocketmq/src/main/java/org/apache/rocketmq/spring/autoconfigure/RocketMQAutoConfiguration.java (2 hunks)
  • laokou-common/laokou-common-rocketmq/src/main/java/org/apache/rocketmq/spring/autoconfigure/RocketMQTransactionConfiguration.java (2 hunks)
  • laokou-sample/laokou-sample-tcp/src/main/java/org/laokou/infrastructure/config/TcpServerHandler.java (1 hunks)
  • laokou-sample/laokou-sample-websocket/src/main/java/org/laokou/adapter/consumer/SubscribeMessageConsumer.java (1 hunks)
  • laokou-sample/laokou-sample-websocket/src/main/java/org/laokou/infrastructure/config/WebSocketMessageProcessor.java (1 hunks)
  • laokou-sample/laokou-sample-websocket/src/main/java/org/laokou/infrastructure/config/WebSocketServerHandler.java (1 hunks)
  • laokou-service/laokou-admin/laokou-admin-start/src/test/java/org/laokou/admin/Elasticsearch8ApiTest.java (1 hunks)
  • laokou-service/laokou-auth/laokou-auth-adapter/src/main/java/org/laokou/auth/consumer/handler/LoginEventHandler.java (1 hunks)
  • laokou-service/laokou-auth/laokou-auth-app/src/main/java/org/laokou/auth/command/LoginLogSaveCmdExe.java (1 hunks)
  • laokou-service/laokou-auth/laokou-auth-app/src/main/java/org/laokou/auth/service/LoginLogServiceImpl.java (1 hunks)
  • laokou-service/laokou-auth/laokou-auth-app/src/main/java/org/laokou/auth/service/authentication/OAuth2AuthenticationProcessor.java (3 hunks)
  • laokou-service/laokou-auth/laokou-auth-client/src/main/java/org/laokou/auth/api/LoginLogServiceI.java (1 hunks)
  • laokou-service/laokou-auth/laokou-auth-client/src/main/java/org/laokou/auth/dto/CaptchaGetQry.java (1 hunks)
  • laokou-service/laokou-auth/laokou-auth-client/src/main/java/org/laokou/auth/dto/CaptchaSendCmd.java (1 hunks)
  • laokou-service/laokou-auth/laokou-auth-client/src/main/java/org/laokou/auth/dto/LoginLogSaveCmd.java (1 hunks)
  • laokou-service/laokou-auth/laokou-auth-client/src/main/java/org/laokou/auth/dto/TokenRemoveCmd.java (1 hunks)
  • laokou-service/laokou-auth/laokou-auth-client/src/main/java/org/laokou/auth/dto/clientobject/LoginLogCO.java (1 hunks)
  • laokou-service/laokou-auth/laokou-auth-client/src/main/java/org/laokou/auth/dto/domainevent/LoginEvent.java (2 hunks)
  • laokou-service/laokou-auth/laokou-auth-client/src/main/java/org/laokou/auth/dto/domainevent/NoticeMessageEvent.java (0 hunks)
  • laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/ability/DomainService.java (2 hunks)
  • laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/gateway/LoginLogGateway.java (1 hunks)
  • laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/model/AuthA.java (3 hunks)
  • laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/model/Constant.java (1 hunks)
  • laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/model/LoginLogE.java (1 hunks)
  • laokou-service/laokou-auth/laokou-auth-infrastructure/src/main/java/org/laokou/auth/common/constant/Constant.java (0 hunks)
  • laokou-service/laokou-auth/laokou-auth-infrastructure/src/main/java/org/laokou/auth/common/constant/MqConstant.java (0 hunks)
  • laokou-service/laokou-auth/laokou-auth-infrastructure/src/main/java/org/laokou/auth/convertor/LoginLogConvertor.java (1 hunks)
  • laokou-service/laokou-auth/laokou-auth-infrastructure/src/main/java/org/laokou/auth/convertor/NoticeLogConvertor.java (0 hunks)
  • laokou-service/laokou-auth/laokou-auth-infrastructure/src/main/java/org/laokou/auth/gatewayimpl/LoginLogGatewayImpl.java (2 hunks)
  • laokou-service/laokou-auth/laokou-auth-start/src/test/java/org/laokou/auth/OAuth2ApiTest.java (1 hunks)
  • laokou-service/laokou-generator/laokou-generator-domain/src/main/java/org/laokou/generator/model/GeneratorA.java (1 hunks)
  • laokou-service/laokou-generator/laokou-generator-start/src/test/java/org/laokou/generator/TableTest.java (1 hunks)
  • laokou-service/laokou-logstash/laokou-logstash-adapter/src/main/java/org/laokou/logstash/consumer/TraceHandler.java (1 hunks)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@KouShenhai KouShenhai merged commit 127a37f into master Dec 22, 2024
7 of 12 checks passed
Copy link

sourcery-ai bot commented Dec 22, 2024

审核指南由 Sourcery 提供

此拉取请求通过将 LoginEvent 发布到 RocketMQ 并消费它以将日志保存到数据库来实现登录日志记录。它还重构了 DomainEvent 和相关组件以支持此功能。

登录日志记录过程的时序图

sequenceDiagram
    participant User as User
    participant Auth as AuthenticationProcessor
    participant AuthA as AuthA
    participant RMQ as RocketMQ
    participant Handler as LoginEventHandler
    participant DB as Database

    User->>Auth: Login request
    Auth->>AuthA: authenticate
    AuthA-->>Auth: authentication result
    alt login success/failure
        AuthA->>AuthA: recordLog()
        AuthA->>RMQ: publish LoginEvent
        RMQ->>Handler: consume LoginEvent
        Handler->>DB: save login log
    end
    Auth-->>User: login response
Loading

登录日志记录组件的类图

classDiagram
    class LoginEventHandler {
        -LoginLogServiceI loginLogServiceI
        +handleDomainEvent(DomainEvent)
    }
    class LoginLogE {
        +String username
        +String ip
        +String address
        +String browser
        +String os
        +Integer status
        +String errorMessage
        +String type
        +Instant instant
        +Long tenantId
    }
    class LoginEvent {
        +String username
        +String ip
        +String address
        +String browser
        +String os
        +Integer status
        +String errorMessage
        +String type
        +Instant instant
    }
    class DomainEvent {
        +String payload
        +String type
        +String sourcePrefix
        +Long tenantId
        +Long userId
        +Long aggregateId
        +String topic
        +String tag
        +int version
    }

    LoginEventHandler --|> AbstractDomainEventHandler
    LoginEvent --* DomainEvent: payload
    LoginLogE --o LoginEventHandler: creates
Loading

文件级别的更改

更改 详情 文件
实现了登录日志记录。
  • 添加了 LoginEventHandler 以消费 LoginEvent 并保存登录日志。
  • AuthA 中添加了 recordLog 方法以发布 LoginEvent
  • 修改了 OAuth2AuthenticationProcessor 中的 authenticationToken 方法以发布事件。
  • DomainService 中添加了 createLoginLog 方法。
  • LoginLogGateway 中添加了 create 方法。
  • 实现了 LoginLogGatewayImpl
  • 添加了 LoginLogELoginLogCOLoginLogDOLoginLogConvertorLoginLogSaveCmdLoginLogSaveCmdExeLoginLogServiceImpl
  • 添加了与 loginLog 相关的常量。
  • 移除了 NoticeMessageEventNoticeLogConvertor
  • 修改了 DomainEvent 以包含 typeinstant 字段。
  • 重构了 AbstractDomainEventHandler 以直接处理 DomainEvent
  • 添加了 EventType.LOGIN
  • 移除了与通知和日志表相关的未使用常量。
  • 移除了 pom.xml 文件中未使用的依赖项。
  • 更新了 pom.xml 文件中的依赖项。
  • 在 DTO 中添加了 Swagger 注释。
  • 为新功能添加了单元测试并更新了现有测试。
  • 更新了数据库架构以包含登录日志表。
  • 更新了 NacosRouteDefinitionRepository 以使用新 API。
  • 更新了 ElasticsearchTemplate 以使用新 API。
  • 更新了 LogE 以包含新字段。
  • 更新了 ReactiveResponseUtil 以使用新 API。
  • 更新了 TcpServerHandler 以使用新 API。
  • 更新了 SubscribeMessageConsumer 以使用新 API。
  • 更新了 WebSocketMessageProcessor 以使用新 API。
  • 更新了 WebSocketServerHandler 以使用新 API。
  • 更新了 Elasticsearch8ApiTest 以使用新 API。
  • 更新了 OAuth2ApiTest 以使用新 API。
  • 更新了 GeneratorA 以使用新 API。
  • 更新了 TableTest 以使用新 API。
  • 更新了 TraceHandler 以使用新 API。
laokou-service/laokou-auth/laokou-auth-adapter/src/main/java/org/laokou/auth/consumer/handler/LoginEventHandler.java
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/model/AuthA.java
laokou-service/laokou-auth/laokou-auth-app/src/main/java/org/laokou/auth/service/authentication/OAuth2AuthenticationProcessor.java
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/ability/DomainService.java
laokou-service/laokou-auth/laokou-auth-gatewayimpl/src/main/java/org/laokou/auth/gatewayimpl/LoginLogGatewayImpl.java
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/gateway/LoginLogGateway.java
laokou-service/laokou-auth/laokou-auth-client/src/main/java/org/laokou/auth/dto/domainevent/LoginEvent.java
/dev/null
/dev/null
/dev/null
/dev/null
/dev/null
laokou-service/laokou-auth/laokou-auth-client/src/main/java/org/laokou/auth/api/LoginLogServiceI.java
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/model/Constant.java
重构了 DomainEvent 和相关组件。
  • DomainEvent 中添加了 typeinstant 字段。
  • 重构了 AbstractDomainEventHandler 以直接处理 DomainEvent
  • 添加了 EventType.LOGIN
laokou-common/laokou-common-i18n/src/main/java/org/laokou/common/i18n/dto/DomainEvent.java
laokou-common/laokou-common-domain/src/main/java/org/laokou/common/domain/handler/AbstractDomainEventHandler.java
laokou-common/laokou-common-i18n/src/main/java/org/laokou/common/i18n/common/constant/EventType.java
更新了依赖项和配置。
  • 移除了 pom.xml 文件中未使用的依赖项。
  • 更新了 pom.xml 文件中的依赖项。
  • 更新了 MybatisPlusAutoConfig 以使用 try-with-resources 处理 ExecutorService
  • 重新排序了 NamespaceControllerV2 中的字段和常量。
  • 更新了 RocketMQTransactionConfiguration 以使用 try-with-resources 处理 ExecutorService
  • 更新了 RocketMQAutoConfiguration 以使用 try-with-resources 处理 ExecutorService
  • 更新了 MyBatisExceptionTranslator 以使用更精确的异常处理。
laokou-common/laokou-common-core/pom.xml
laokou-common/laokou-common-i18n/pom.xml
laokou-common/laokou-common-mybatis-plus/src/main/java/org/laokou/common/mybatisplus/config/MybatisPlusAutoConfig.java
laokou-cloud/laokou-nacos/src/main/java/com/alibaba/nacos/console/controller/v2/NamespaceControllerV2.java
laokou-common/laokou-common-rocketmq/src/main/java/org/apache/rocketmq/spring/autoconfigure/RocketMQTransactionConfiguration.java
laokou-common/laokou-common-rocketmq/src/main/java/org/apache/rocketmq/spring/autoconfigure/RocketMQAutoConfiguration.java
laokou-common/laokou-common-mybatis-plus/src/main/java/org/mybatis/spring/MyBatisExceptionTranslator.java

提示和命令

与 Sourcery 互动

  • 触发新审核: 在拉取请求中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审核评论。
  • 从审核评论生成 GitHub 问题: 通过回复审核评论请求 Sourcery 创建问题。
  • 生成拉取请求标题: 在拉取请求标题中任意位置写 @sourcery-ai 以随时生成标题。
  • 生成拉取请求摘要: 在拉取请求正文中任意位置写 @sourcery-ai summary 以随时生成 PR 摘要。您也可以使用此命令指定摘要插入的位置。

自定义您的体验

访问您的仪表板以:

  • 启用或禁用审核功能,如 Sourcery 生成的拉取请求摘要、审核指南等。
  • 更改审核语言。
  • 添加、删除或编辑自定义审核说明。
  • 调整其他审核设置。

获取帮助

Original review guide in English

Reviewer's Guide by Sourcery

This pull request implements login logging by publishing a LoginEvent to RocketMQ and consuming it to save the log to the database. It also refactors the DomainEvent and related components to support this feature.

Sequence diagram for the login logging process

sequenceDiagram
    participant User as User
    participant Auth as AuthenticationProcessor
    participant AuthA as AuthA
    participant RMQ as RocketMQ
    participant Handler as LoginEventHandler
    participant DB as Database

    User->>Auth: Login request
    Auth->>AuthA: authenticate
    AuthA-->>Auth: authentication result
    alt login success/failure
        AuthA->>AuthA: recordLog()
        AuthA->>RMQ: publish LoginEvent
        RMQ->>Handler: consume LoginEvent
        Handler->>DB: save login log
    end
    Auth-->>User: login response
Loading

Class diagram for login logging components

classDiagram
    class LoginEventHandler {
        -LoginLogServiceI loginLogServiceI
        +handleDomainEvent(DomainEvent)
    }
    class LoginLogE {
        +String username
        +String ip
        +String address
        +String browser
        +String os
        +Integer status
        +String errorMessage
        +String type
        +Instant instant
        +Long tenantId
    }
    class LoginEvent {
        +String username
        +String ip
        +String address
        +String browser
        +String os
        +Integer status
        +String errorMessage
        +String type
        +Instant instant
    }
    class DomainEvent {
        +String payload
        +String type
        +String sourcePrefix
        +Long tenantId
        +Long userId
        +Long aggregateId
        +String topic
        +String tag
        +int version
    }

    LoginEventHandler --|> AbstractDomainEventHandler
    LoginEvent --* DomainEvent: payload
    LoginLogE --o LoginEventHandler: creates
Loading

File-Level Changes

Change Details Files
Implemented login logging.
  • Added LoginEventHandler to consume LoginEvent and save login log.
  • Added recordLog method to AuthA to publish LoginEvent.
  • Modified authenticationToken method in OAuth2AuthenticationProcessor to publish events.
  • Added createLoginLog method to DomainService.
  • Added create method to LoginLogGateway.
  • Implemented LoginLogGatewayImpl.
  • Added LoginLogE, LoginLogCO, LoginLogDO, LoginLogConvertor, LoginLogSaveCmd, LoginLogSaveCmdExe, LoginLogServiceImpl.
  • Added loginLog related constants.
  • Removed NoticeMessageEvent and NoticeLogConvertor.
  • Modified DomainEvent to include type and instant fields.
  • Refactored AbstractDomainEventHandler to directly handle DomainEvent.
  • Added EventType.LOGIN.
  • Removed unused constants related to notice and log tables.
  • Removed unused dependencies in pom.xml files.
  • Updated dependencies in pom.xml files.
  • Added Swagger annotations to DTOs.
  • Added unit tests for new features and updated existing tests.
  • Updated database schema to include login log table.
  • Updated NacosRouteDefinitionRepository to use new API.
  • Updated ElasticsearchTemplate to use new API.
  • Updated LogE to include new fields.
  • Updated ReactiveResponseUtil to use new API.
  • Updated TcpServerHandler to use new API.
  • Updated SubscribeMessageConsumer to use new API.
  • Updated WebSocketMessageProcessor to use new API.
  • Updated WebSocketServerHandler to use new API.
  • Updated Elasticsearch8ApiTest to use new API.
  • Updated OAuth2ApiTest to use new API.
  • Updated GeneratorA to use new API.
  • Updated TableTest to use new API.
  • Updated TraceHandler to use new API.
laokou-service/laokou-auth/laokou-auth-adapter/src/main/java/org/laokou/auth/consumer/handler/LoginEventHandler.java
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/model/AuthA.java
laokou-service/laokou-auth/laokou-auth-app/src/main/java/org/laokou/auth/service/authentication/OAuth2AuthenticationProcessor.java
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/ability/DomainService.java
laokou-service/laokou-auth/laokou-auth-gatewayimpl/src/main/java/org/laokou/auth/gatewayimpl/LoginLogGatewayImpl.java
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/gateway/LoginLogGateway.java
laokou-service/laokou-auth/laokou-auth-client/src/main/java/org/laokou/auth/dto/domainevent/LoginEvent.java
/dev/null
/dev/null
/dev/null
/dev/null
/dev/null
laokou-service/laokou-auth/laokou-auth-client/src/main/java/org/laokou/auth/api/LoginLogServiceI.java
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/model/Constant.java
Refactored DomainEvent and related components.
  • Added type and instant fields to DomainEvent.
  • Refactored AbstractDomainEventHandler to directly handle DomainEvent.
  • Added EventType.LOGIN.
laokou-common/laokou-common-i18n/src/main/java/org/laokou/common/i18n/dto/DomainEvent.java
laokou-common/laokou-common-domain/src/main/java/org/laokou/common/domain/handler/AbstractDomainEventHandler.java
laokou-common/laokou-common-i18n/src/main/java/org/laokou/common/i18n/common/constant/EventType.java
Updated dependencies and configurations.
  • Removed unused dependencies in pom.xml files.
  • Updated dependencies in pom.xml files.
  • Updated MybatisPlusAutoConfig to use try-with-resources for ExecutorService.
  • Reordered fields and constants in NamespaceControllerV2.
  • Updated RocketMQTransactionConfiguration to use try-with-resources for ExecutorService.
  • Updated RocketMQAutoConfiguration to use try-with-resources for ExecutorService.
  • Updated MyBatisExceptionTranslator to use more precise exception handling.
laokou-common/laokou-common-core/pom.xml
laokou-common/laokou-common-i18n/pom.xml
laokou-common/laokou-common-mybatis-plus/src/main/java/org/laokou/common/mybatisplus/config/MybatisPlusAutoConfig.java
laokou-cloud/laokou-nacos/src/main/java/com/alibaba/nacos/console/controller/v2/NamespaceControllerV2.java
laokou-common/laokou-common-rocketmq/src/main/java/org/apache/rocketmq/spring/autoconfigure/RocketMQTransactionConfiguration.java
laokou-common/laokou-common-rocketmq/src/main/java/org/apache/rocketmq/spring/autoconfigure/RocketMQAutoConfiguration.java
laokou-common/laokou-common-mybatis-plus/src/main/java/org/mybatis/spring/MyBatisExceptionTranslator.java

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KouShenhai - 我已经审查了你的更改 - 这里有一些反馈:

总体评论

  • ExecutorService 实例在 RocketMQTransactionConfiguration 和 RocketMQAutoConfiguration 中创建后立即被关闭,这将阻止它们被使用。它们应该被管理为长期资源,而不是使用 try-with-resources 块。
这是我在审查期间查看的内容
  • 🟢 一般问题:一切看起来都很好
  • 🟢 安全性:一切看起来都很好
  • 🟢 测试:一切看起来都很好
  • 🟢 复杂性:一切看起来都很好
  • 🟢 文档:一切看起来都很好

Sourcery 对于开源是免费的 - 如果你喜欢我们的评论,请考虑分享它们 ✨
帮助我变得更有用!请在每条评论上点击 👍 或 👎,我将使用反馈来改进你的评论。
Original comment in English

Hey @KouShenhai - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The ExecutorService instances are being closed immediately after creation in RocketMQTransactionConfiguration and RocketMQAutoConfiguration, which would prevent them from being used. These should be managed as long-lived resources instead of using try-with-resources blocks.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
11.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link

codecov bot commented Dec 22, 2024

Codecov Report

Attention: Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.

Project coverage is 15.26%. Comparing base (4da193f) to head (2ae080d).
Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
...n/java/org/laokou/common/i18n/dto/DomainEvent.java 0.00% 13 Missing ⚠️
.../laokou/common/i18n/common/constant/EventType.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3179      +/-   ##
============================================
- Coverage     15.37%   15.26%   -0.12%     
  Complexity       66       66              
============================================
  Files            85       85              
  Lines          1372     1382      +10     
  Branches        109      109              
============================================
  Hits            211      211              
- Misses         1135     1145      +10     
  Partials         26       26              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant