mirror of
https://gitee.com/pnoker/iot-dc3.git
synced 2026-11-01 10:41:52 +08:00
* fix(api): correct inverted enable_flag comment and document time unit - tenant.proto enable_flag comment said "1 enabled, 0 disabled" but the actual EnableFlagEnum is ENABLE=0, DISABLE=1 — callers reading the comment would invert the flag. Correct it. - base.proto create_time/operate_time are epoch milliseconds (LocalDateTimeUtil/Instant.toEpochMilli); document the unit so callers don't guess seconds vs millis. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(api): carry timestamp in point-value history; explicit bool presence #5 Point-value history: the whole chain (proto -> gRPC server -> PointValueService -> repository -> facades -> controller -> agentic tool) returned List<String> and dropped create_time even though the DB row already carried it. Switch to PointValueBO / FacadePointValueBO end to end so callers receive each value with its timestamp. #6 Field presence: GrpcR.ok and McpIntrospectDTO.active are now optional bool, so "unset" is distinguishable from false on the wire. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(auth): unify JWT signing key, drop salt/password from token contract The JWT signing key was per-principal — securityKey + ":" + salt, where salt was the credential salt also carried through the gateway and the token RPC. That makes the JWT key weak and widens salt exposure to every gateway hop. Sign with the single configured securityKey (HS256) instead and remove salt from the JWT path entirely: - KeyUtil.generateToken/parserToken drop the salt parameter; the HMAC key is now just securityKey (must be >= 32 bytes for HS256). - TokenService.generateToken/checkValid drop the salt parameter. - token.proto GrpcLoginQuery drops salt and password — CheckValid only ever needed tenant, name and token. - gateway FilterService, TokenGrpcFacade, TokenController adapted; the request header no longer feeds salt into validation. The login-handshake salt (POST /token/salt, used to salt the password client-side before verifyPassword) is unchanged — only the JWT signing salt is removed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * refactor(api): type MCP authorize decision as proto enum The authorize-tool-call decision was a free-form string, so callers could only compare it against literals with no compile-time check. Introduce GrpcMcpDecision (MCP_DECISION_UNSPECIFIED / AUTHORIZED / CONFIRM_REQUIRED / REJECTED) and type GrpcMcpToolAuthorizeDTO.decision with it. Enum names match the existing auth-side literals, so the mapping is a direct valueOf / name(). - McpRuntimeServer builds the enum via toGrpcDecision (unknown -> UNSPECIFIED). - McpRuntimeGrpcFacade maps enum -> BO string via name(). - gateway unchanged: it receives the BO (string decision) through the facade. The other string MCP fields (risk_level, status, grant_type, principal_type) stay strings for now — their value sets are wider and partly lowercase (OAuth grant_type), so they are a follow-up. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(facade): align TokenLocalFacade with 3-arg checkValid (CI compile fix) TokenLocalFacade (local impl) was missed when TokenFacade.checkValid dropped salt; CI compiles facade-local-auth independently and caught it. Align it + its test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
DC3 Common Data
Overview
dc3-common-data is the shared Data Center business module of the IoT DC3 platform. It provides all service
implementations for point value ingestion, command dispatch,
driver/device status tracking, and data query. It is wired into dc3-center-data.
Module Information
- Group ID: io.github.pnoker
- Artifact ID: dc3-common-data
- Version: 2026.5.22
Key Components
| Layer | Contents |
|---|---|
| Controllers | REST controllers for point value read/write, query, status |
| Services | PointCommandService, PointValueService, DriverStatusService, DeviceStatusService |
| gRPC Clients | @GrpcClient(ManagerConstant.SERVICE_NAME) stubs for DriverApi, PointApi |
| RabbitMQ | Producer for dc3.e.command; Consumer for dc3.e.value, dc3.e.event |
| Init | DataInitRunner for startup preparation |
Command Dispatch Flow
REST /api/v3/data/point_value/read
→ PointCommandServiceImpl
→ gRPC: driverApiBlockingStub.selectByDeviceId()
→ RabbitMQ: dc3.e.command / dc3.r.command.device.{serviceName}
→ Driver receives and acts
MQ Topics
| Exchange | Queue | Direction |
|---|---|---|
dc3.e.value |
dc3.q.value.point |
Inbound (from drivers) |
dc3.e.command |
dc3.q.command.device.{service} |
Outbound (to drivers) |
dc3.e.event |
dc3.q.event.driver / dc3.q.event.device |
Inbound (status events) |
Build Instructions
mvn -s ../../.mvn/settings.xml clean package
Related Modules
dc3-center-data— Bootstraps this module as a Spring Boot servicedc3-api-manager— gRPC API consumed by this module for driver/point resolutiondc3-common-repository— Storage adapter for persisting point valuesdc3-common-rabbitmq— RabbitMQ exchange/queue configuration
License
Copyright 2016-present the IoT DC3 original author or authors.
Licensed under the GNU Affero General Public License v3.0 (AGPL 3.0)