feat(gateway): 新增智电改造网关台账功能(ICC消防物联设备同步) - 新建electric_gateway表(迁移20261024_icc_gateway.sql并同步db_seed:自增id、icc_imei/device_code双唯一、orgCode经customer.icc_code解析customer_id、equip_id可空、is_online/synced_at等);同步服务IccGatewaySyncService复用OAuth2真实鉴权分页拉取消防物联设备(POST /device/subsystem/page)并按imei幂等upsert写icc_sync_log;新增GET /api/electric-gateways列表/详情与POST /sync手动同步(RBAC device:list);注册icc_gateway_sync每10分钟定时任务(菜单62/role_menu/sys_job种子);前端网关台账页(搜索/筛选/同步按钮/在线状态tag/分页)与路由;server补装undici依赖
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
This commit is contained in:
1 parent
9d3bb13ecf
commit
cf0a0d4d31
21 files changed
+1439
-272
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import { Controller, Get, Post, Inject, Query, Param } from "@midwayjs/core";
|
||||
import { Context } from "@midwayjs/koa";
|
||||
import { ElectricGatewayService } from "../service/electric_gateway.service";
|
||||
import { IccGatewaySyncService } from "../service/icc_gateway_sync.service";
|
||||
|
||||
@Controller("/api/electric-gateways")
|
||||
export class ElectricGatewayController {
|
||||
@Inject() ctx!: Context;
|
||||
@Inject() electricGatewayService!: ElectricGatewayService;
|
||||
@Inject() iccGatewaySyncService!: IccGatewaySyncService;
|
||||
|
||||
@Get("/") async list(@Query() query: any) { return this.electricGatewayService.list(query, this.ctx); }
|
||||
@Get("/:id") async detail(@Param("id") id: string) { return this.electricGatewayService.detail(Number(id), this.ctx); }
|
||||
@Post("/sync") async sync() {
|
||||
const result = await this.iccGatewaySyncService.syncFromIcc(this.ctx);
|
||||
return { code: 200, message: "网关设备同步完成", data: result };
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user