backend/robot-service/README.md
A comprehensive backend service for RPA robot design, execution, terminal management, auditing and monitoring.
This project is a backend service based on Spring Boot, providing RPA robot design, version management, execution orchestration, scheduled tasks, runtime monitoring, auditing and notification capabilities. The project has integrated single sign-on (casdoor), data access (MyBatis-Plus + Druid), caching (Redis), scheduled tasks (Spring Scheduling), remote calls (OpenFeign), logging (Logback) and other infrastructure.
robot8040/api/robot82.3.11.RELEASE2.2.0.RELEASE@EnableFeignClients enabled)/opt/log/rpa/${spring.application.name}/)com.mysql.cj.jdbc.Driver)openjdk:8-jre-alpinesrc/main/java/com/iflytek/rpa/
├─ RobotApplication.java // Application startup class (@SpringBootApplication, @EnableFeignClients, @EnableScheduling, @EnableRedisHttpSession, @EnableAsync)
├─ conf/ // Global configuration and base controllers
│ ├─ ApiContext.java // Simple request context (tenantId/userId, etc.)
│ ├─ FeignConfiguration.java // Feign related configuration (request header passing, etc.)
│ ├─ MybatisPlusConfig.java // Pagination plugin, etc.
│ └─ RedisConfig.java // Enable Redis transaction support
├─ auth/ // Authentication module: casdoor integration, user management, JWT filters, etc.
├─ base/ // Base metadata module (atoms, processes, parameters, modules, groups, global variables, etc.)
├─ robot/ // Robot core: design, version, execution, shared variables/files, resource management
├─ task/ // Scheduled tasks: task definition, execution records, log pulling, etc.
├─ triggerTask/ // Trigger tasks: trigger rules/task mailboxes, etc.
├─ monitor/ // Monitoring and statistics: historical terminals/robots, statistical reports
├─ notify/ // Notification sending
├─ market/ // Market/application management extensions
├─ component/ // Component management module
├─ starter/ // Custom starter: common utilities, response encapsulation, exception handling, etc.
└─ utils/ // Common utilities (pagination, time, ID, HTTP, anti-shake, monitoring assistance, etc.)
src/main/resources/
├─ bootstrap.yml // Application name/port/context, default profile
├─ application-local.yml // Local development configuration
└─ logback-delayed.xml // Logging configuration
Default active profile:
local(seebootstrap.yml). Please override sensitive information (DB/Redis/casdoor/S3) in different environments. Account passwords in example configuration files are only placeholders/examples and must be replaced with secure sources (environment variables, K8s Secrets, etc.).
server.port: Default 8040server.servlet.context-path: /api/robotspring.datasource.*: Driver, connection pool (stat,wall,slf4j filters), slow SQL loggingmybatis-plus.mapper-locations: classpath:/mapper/*/*.xmllogic-delete-value: 1 / logic-not-delete-value: 0PaginationInterceptor (see MybatisPlusConfig)spring.redis.*: Database, address, connection pool, timeoutStringRedisTemplate transaction support in RedisConfigredis.open switch, anti-shake configuration deBounce.prefix/windowcasdoor.cas-server-context / rest-server-url: casdoor service addresscasdoor.cas-client-context: Current application backend context address (note: backend, not frontend)casdoor.session-filter-exclude / casdoor.access-auth-exclude: Login/authentication whitelistcas.client.context / cas.client.index: Post-login redirect/homepageallowed.origins: Cross-origin domain whitelistreport.export.strategy: excel, buffer/Sheet names, file naming templatesamazonaws.s3.url/accessKey/secretKey/bucket/prefix/maxConnectionsThe following only lists module-level basic route prefixes. Detailed interfaces can be viewed through source
code @GetMapping/@PostMapping:
/auth*)
/login-status: Query login status/logout: Logout and clean related data/user/info: Get current logged-in user info/robot-*)
/robot-design: Create, rename, list, details, copy, delete, share/robot-version: Same name validation, publish, enable/restore, list/robot-execute: Execution list, delete, update, details, pre-execution check/robot-record: Execution record list, logs, details, result save, batch delete/robot-shared-var, /robot-shared-file: Shared variable/file management/robot-manage: Resource/deployment/transfer/version/execution statistics, etc./task*, /triggerTask)
/task: Task list, save, start/stop, delete, name validation, next time/task-execute: Execution status, list, batch delete/triggerTask: Trigger name validation, insert/query/delete/update, pagination, etc./taskMail: Task mailbox connection, save, delete/atom, /param, /module, /process, /group, /global, /require, /element, etc.)/market-*, /application)/his-*) and Statistical Reports/notify)/component*)Tip: Controllers are located in
controllerpackages of each module; DAOs inheritBaseMapper<T>, located indao/mapperpackages; entities and constants inentity/constantspackages;annotationcontains module custom annotations (if any).
robot module@EnableScheduling; typical tasks:
SharedVarServiceImpl: Shared variable daily maintenance (cron: 1 0 0 * * *)StatisticsServiceImpl: Statistical report tasks (cron: 0 0 1 * * ?)DeBounceUtils uses Redis to build Key-based anti-shake window (millisecond level), window and prefix adjustable
in config deBounce.*RedisTemplate.executePipelined in monitoring servicesreport.*ApiContext exposes tenantId/userId set and get methods; recommend combining with interceptors or ThreadLocal for
isolation optimizationPrerequisites
Local Run
# 1) Replace database/Redis/casdoor/S3 sensitive configurations in application-local.yml
# 2) Compile and package (default configured <skipTests>true</skipTests>)
mvn clean package -DskipTests
# 3) Run
java -jar target/robot-0.0.1-SNAPSHOT.jar --spring.profiles.active=local
# Optional: adjust port/context
# --server.port=8040 --server.servlet.context-path=/api/robot
# Build image (ensure target/*.jar exists)
docker build -t robot:local .
# Run (please override sensitive configurations with environment variables)
docker run -d --name robot \
-p 8040:8040 \
-e SPRING_PROFILES_ACTIVE=prod \
robot:local
Note:
Dockerfilebased onopenjdk:8-jre-alpineimage, default placestarget/*.jarto root directory. Startup command can be specified viaCMDorargsin orchestration (K8s/Compose).
controller only does input validation and orchestration, service carries business logic, dao only does data
access, entity is data modelAppResponseutils utility classes in repository, prioritize reuse@Valid/@Validated; validate public methods for null valuessession-filter-exclude and access-auth-exclude whitelistmybatis-plus.mapper-locations and pom.xml resource packaging configuration
for src/main/java/**/*.xmlRedisConfig enabled StringRedisTemplate.setEnableTransactionSupport(true) and correctly use
transactions in needed logicreport.excel.buffer.size and robot.maxLines, or paginated export/opt/log/rpa/; or customize Logback configuration