feat(customer): 新增ICC客户信息同步功能 - OAuth2密码模式鉴权拉取org_base客户、按icc_code幂等upsert写入并记录icc_sync_log,注册每10分钟定时任务;客户档案管理页新增手动'同步客户'按钮(POST /api/customers/sync/icc),同步后自动刷新列表与统计;customer表新增icc_code字段及唯一索引,同步db_seed与设计文档
This commit is contained in:
1 parent
be91d04431
commit
9d3bb13ecf
24 files changed
+1159
-5
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { Controller, Get, Post, Put, Del, Inject, Query, Body, Param } from "@midwayjs/core";
|
||||
import { Context } from "@midwayjs/koa";
|
||||
import { CustomerService } from "../service/customer.service";
|
||||
import { IccCustomerSyncService } from "../service/icc_customer_sync.service";
|
||||
|
||||
@Controller("/api/customers")
|
||||
export class CustomerController {
|
||||
@@ -10,6 +11,9 @@ export class CustomerController {
|
||||
@Inject()
|
||||
customerService!: CustomerService;
|
||||
|
||||
@Inject()
|
||||
iccCustomerSyncService!: IccCustomerSyncService;
|
||||
|
||||
@Get("/")
|
||||
async list(@Query() query: any) {
|
||||
const result = await this.customerService.list(query, this.ctx);
|
||||
@@ -28,6 +32,16 @@ export class CustomerController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Post("/sync/icc")
|
||||
async syncIccCustomers() {
|
||||
const result = await this.iccCustomerSyncService.syncFromIcc(this.ctx);
|
||||
return {
|
||||
code: 200,
|
||||
message: "同步完成",
|
||||
data: result
|
||||
};
|
||||
}
|
||||
|
||||
@Get("/:id")
|
||||
async detail(@Param("id") id: string) {
|
||||
const result = await this.customerService.detail(Number(id), this.ctx);
|
||||
|
||||
Reference in new issue
Block a user