# Customization
This system supports customized development using the Groovy (opens new window) language. Groovy is a superset of the Java language, supporting Java syntax while adding more dynamic features, making it more suitable for domain modeling and runtime enhancement.
TIP
If the team is not familiar with Groovy, they can also develop using pure Java syntax. Groovy has excellent compatibility with Java.
# Target Audience
This document is intended for: developers and implementers of this system
# Structure of Dynamic Logic Definition
Dynamic logic can be maintained through the menu Development Customization
-> Dynamic Logic
-> Dynamic Logic
, with related properties shown in the following image:
Detailed descriptions of relevant fields are as follows
# Dynamic Logic Engine Overview
The system provides a dynamic logic engine for executing dynamic logic within the system. Dynamic logic can be a piece of Groovy code, an external operating system command, or a call to a large language model, etc.
Dynamic Logic Engine | Description | preLogic | DynamicPrompt | postLogic |
---|---|---|---|---|
JASPER_REPORT | Used to render Jasper reports to PDF files | Supported | Not Applicable | Supported |
LLM_ENGINE | Used to request large language models | Supported | Supported | Supported |
RENDER_LINK | Alias for GROOVY_CODE, returns a link to the caller | Supported | Not Applicable | Supported |
OS_COMMAND | Used to execute operating system commands | Supported | Supported | Supported |
GROOVY_CODE | Used to execute Groovy code | Supported | Not Applicable | Supported |
TIP
The name field of dynamic logic-related objects cannot be modified after creation.
# Dynamic Logic Development Guide
# Dynamic Logic Overview
Dynamic logic is a flexible way to implement business logic, allowing developers to define pre-processing logic, post-processing logic, and Prompt templates according to business needs. Through dynamic logic, you can easily implement customization and automation of business processes, improving the flexibility and efficiency of business processing.
# Defining Dynamic Logic
When defining dynamic logic, you need to focus on the following aspects:
- Pre-processing Logic (preLogic): Logic executed before the main business logic, used for data preparation or pre-processing.
- Post-processing Logic (postLogic): Logic executed after the main business logic, used for processing results or performing subsequent operations.
- DynamicPrompt Template: Template used to generate dynamic content, which can be dynamically rendered based on the results of pre-processing logic.
# Parameter Passing and Result Handling
During the execution of dynamic logic, please note the following points:
- Pre-processing Result Passing: The results of pre-processing logic will be passed to subsequent Prompt rendering, main business logic, and post-processing logic.
- Prompt Rendering: The Prompt template will be rendered based on the results of pre-processing logic and other input parameters to generate dynamic content.
- Post-processing Logic Parameters: Post-processing logic will receive the results of the main business logic and other necessary parameters for result processing.
- Returning Results: Finally, the execution results of dynamic logic will be returned to the caller for subsequent business processes or display.
# Practical Application Examples
Here are some specific business scenarios and dynamic logic definition examples:
# Automatic Customer Credit Limit Adjustment
Business Scenario: Automatically adjust customer credit limits based on historical transaction records and payment situations.
Dynamic Logic Definition:
- Pre-processing Logic (preLogic): Query customer's historical transaction records, payments, and overdue situations.
- DynamicPrompt: Generate credit limit adjustment suggestions based on query results.
- Post-processing Logic (postLogic): Update customer credit limit based on suggestions and send notifications.
# Intelligent Work Order Assignment
Business Scenario: Automatically assign work orders based on order content and technicians' professional fields.
Dynamic Logic Definition:
- Pre-processing Logic: Extract key information from work orders, query available technicians and their professional fields.
- DynamicPrompt: Generate best match recommendations based on work order information and technicians' expertise.
- Post-processing Logic: Execute work order assignment, update system status, and notify relevant personnel.
# Dynamic Pricing Strategy
Business Scenario: Dynamically adjust product prices based on market demand, inventory status, and competitor prices.
Dynamic Logic Definition:
- Pre-processing Logic: Collect market data, inventory information, and competitor prices.
- DynamicPrompt: Analyze data and generate price adjustment suggestions.
- Post-processing Logic: Update product prices, synchronize to sales systems, and notify relevant departments.
These examples demonstrate how dynamic logic can be applied in different business scenarios, achieving intelligent and automated business processes through flexible pre-processing, DynamicPrompt, and post-processing logic.
The above guide aims to help developers better understand and implement dynamic logic to meet the needs of different business scenarios. In practical applications, customizing and optimizing dynamic logic according to specific business requirements can achieve flexibility and automation of business processes.
# Dynamic Logic Types
The following lists the types of customization logic currently supported in the system and their usage scenarios:
- Library Functions: Functions available for other customization logic to call.
- Dynamic Permissions: Dynamic creation permission judgment, deletion and update permission judgment for objects.
- Form and Field Customization: Field interactions in forms, dropdown options, field hiding and displaying, etc.
- Object Lifecycle Customization: Injection of customization logic before and after object creation, modification, deletion, and access.
- Dynamic Actions: Enabling logic and core logic of dynamic actions.
- Scheduled Tasks: Enabling logic and core logic of scheduled tasks.
- Dashboards: Enabling logic and core logic of dashboards and widgets.
- Filters: Enabling logic and filter condition configuration of filters.
- Dynamic Services: Core logic of dynamic services.
- Dynamic Integration: Enabling logic and core logic of dynamic integration.
The following sections provide detailed explanations of the application of dynamic logic in different business scenarios: