{ "swagger": "2.0", "info": { "description": "防伪溯源系统 API 文档", "title": "Trace System API", "termsOfService": "http://swagger.io/terms/", "contact": { "name": "API Support", "url": "http://www.swagger.io/support", "email": "support@swagger.io" }, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "1.0" }, "host": "localhost:8080", "basePath": "/api", "paths": { "/aftersales": { "get": { "security": [ { "BearerAuth": [] } ], "description": "支持分页、搜索、按状态/服务类型/技术员筛选", "produces": [ "application/json" ], "tags": [ "售后工单" ], "summary": "获取售后工单列表", "parameters": [ { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "limit", "in": "query" }, { "type": "string", "description": "搜索关键词", "name": "search", "in": "query" }, { "type": "string", "description": "工单状态", "name": "workOrderStatus", "in": "query" }, { "type": "string", "description": "服务类型", "name": "serviceType", "in": "query" }, { "type": "integer", "description": "技术员 ID", "name": "technicianId", "in": "query" }, { "type": "boolean", "description": "仅查看自己负责的工单", "name": "mine", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.PaginationResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "创建一个新的售后工单并分配编号", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "售后工单" ], "summary": "创建售后工单", "parameters": [ { "description": "工单数据", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.CreateAftersalesOrderDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/aftersales/{serialNumber}": { "get": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "售后工单" ], "summary": "获取售后工单详情", "parameters": [ { "type": "string", "description": "工单号", "name": "serialNumber", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "售后工单" ], "summary": "删除售后工单", "parameters": [ { "type": "string", "description": "工单号", "name": "serialNumber", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.BaseResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } }, "patch": { "security": [ { "BearerAuth": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "售后工单" ], "summary": "更新售后工单", "parameters": [ { "type": "string", "description": "工单号", "name": "serialNumber", "in": "path", "required": true }, { "description": "更新数据", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.UpdateAftersalesOrderDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/aftersales/{serialNumber}/confirm": { "post": { "description": "客户输入手机号后四位后选择已授权或未授权", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "售后工单查询" ], "summary": "客户授权确认", "parameters": [ { "type": "string", "description": "工单号", "name": "serialNumber", "in": "path", "required": true }, { "description": "确认数据", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.CustomerConfirmDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "429": { "description": "Too Many Requests", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/aftersales/{serialNumber}/force-close": { "post": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "售后工单" ], "summary": "强制关闭工单", "parameters": [ { "type": "string", "description": "工单号", "name": "serialNumber", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/aftersales/{serialNumber}/qrcode": { "post": { "security": [ { "BearerAuth": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "售后工单" ], "summary": "生成售后工单二维码", "parameters": [ { "type": "string", "description": "工单号", "name": "serialNumber", "in": "path", "required": true }, { "description": "二维码参数", "name": "data", "in": "body", "schema": { "$ref": "#/definitions/models.QRCodeDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.QRCodeResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/aftersales/{serialNumber}/query": { "get": { "produces": [ "application/json" ], "tags": [ "售后工单查询" ], "summary": "公开查询售后工单", "parameters": [ { "type": "string", "description": "工单号", "name": "serialNumber", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/aftersales/{serialNumber}/reassign": { "post": { "security": [ { "BearerAuth": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "售后工单" ], "summary": "重新分配技术员", "parameters": [ { "type": "string", "description": "工单号", "name": "serialNumber", "in": "path", "required": true }, { "description": "新技术员 ID", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.ReassignAftersalesDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/aftersales/{serialNumber}/submit": { "post": { "security": [ { "BearerAuth": [] } ], "description": "技术员填写处理结果后提交,工单进入\"待客户确认\"状态", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "售后工单" ], "summary": "提交客户确认", "parameters": [ { "type": "string", "description": "工单号", "name": "serialNumber", "in": "path", "required": true }, { "description": "处理结果", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.SubmitForConfirmationDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/auth/change-password": { "post": { "security": [ { "BearerAuth": [] } ], "description": "修改当前登录用户的密码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "修改密码", "parameters": [ { "description": "密码修改数据", "name": "passwordData", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.ChangePasswordDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.BaseResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/auth/login": { "post": { "description": "验证用户身份并返回 JWT 令牌", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "用户登录", "parameters": [ { "description": "登录数据", "name": "loginData", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.LoginDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.LoginResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/auth/logout": { "post": { "security": [ { "BearerAuth": [] } ], "description": "用户登出(JWT 无状态,前端清理令牌即可)", "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "用户登出", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.BaseResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/auth/profile": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前登录用户的个人信息", "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "获取用户信息", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "更新当前登录用户的个人信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "更新用户信息", "parameters": [ { "description": "用户信息更新数据", "name": "profileData", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.UpdateProfileDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/companies": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取企业列表,支持分页和搜索", "produces": [ "application/json" ], "tags": [ "企业管理" ], "summary": "获取企业列表", "parameters": [ { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "limit", "in": "query" }, { "type": "string", "description": "搜索关键词", "name": "search", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.PaginationResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "创建新的企业", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "企业管理" ], "summary": "创建企业", "parameters": [ { "description": "企业数据", "name": "companyData", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.CompanyDataRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/models.CompanyResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/companies/stats/overview": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取企业、序列号统计数据", "produces": [ "application/json" ], "tags": [ "企业管理" ], "summary": "获取企业统计概览", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/companies/{companyName}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定企业详情(含序列号分页)", "produces": [ "application/json" ], "tags": [ "企业管理" ], "summary": "获取企业详情", "parameters": [ { "type": "string", "description": "企业名称", "name": "companyName", "in": "path", "required": true }, { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "更新企业信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "企业管理" ], "summary": "更新企业信息", "parameters": [ { "type": "string", "description": "企业名称", "name": "companyName", "in": "path", "required": true }, { "description": "企业数据", "name": "companyData", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.CompanyUpdateRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.CompanyResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "删除企业及其关联序列号", "produces": [ "application/json" ], "tags": [ "企业管理" ], "summary": "删除企业", "parameters": [ { "type": "string", "description": "企业名称", "name": "companyName", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.BaseResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/companies/{companyName}/revoke": { "post": { "security": [ { "BearerAuth": [] } ], "description": "吊销企业及其关联序列号", "produces": [ "application/json" ], "tags": [ "企业管理" ], "summary": "吊销企业", "parameters": [ { "type": "string", "description": "企业名称", "name": "companyName", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.BaseResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/companies/{companyName}/serials/{serialNumber}": { "delete": { "security": [ { "BearerAuth": [] } ], "description": "删除指定企业下的序列号", "produces": [ "application/json" ], "tags": [ "企业管理" ], "summary": "删除企业序列号", "parameters": [ { "type": "string", "description": "企业名称", "name": "companyName", "in": "path", "required": true }, { "type": "string", "description": "序列号", "name": "serialNumber", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.BaseResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/employee-serials": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取员工序列号列表,支持分页和搜索", "produces": [ "application/json" ], "tags": [ "员工赋码管理" ], "summary": "获取员工序列号列表", "parameters": [ { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "limit", "in": "query" }, { "type": "string", "description": "搜索关键词", "name": "search", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.PaginationResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/employee-serials/generate": { "post": { "security": [ { "BearerAuth": [] } ], "description": "生成指定数量的员工序列号(无有效期)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "员工赋码管理" ], "summary": "生成员工序列号", "parameters": [ { "description": "生成数据", "name": "generateData", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.GenerateEmployeeSerialDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/employee-serials/{serialNumber}": { "put": { "security": [ { "BearerAuth": [] } ], "description": "更新指定员工序列号的信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "员工赋码管理" ], "summary": "更新员工序列号信息", "parameters": [ { "type": "string", "description": "序列号", "name": "serialNumber", "in": "path", "required": true }, { "description": "更新数据", "name": "updateData", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.UpdateEmployeeSerialDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "删除指定员工序列号(物理删除)", "produces": [ "application/json" ], "tags": [ "员工赋码管理" ], "summary": "删除员工序列号", "parameters": [ { "type": "string", "description": "序列号", "name": "serialNumber", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.BaseResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/employee-serials/{serialNumber}/qrcode": { "post": { "security": [ { "BearerAuth": [] } ], "description": "为指定员工序列号生成查询二维码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "员工赋码管理" ], "summary": "生成员工二维码", "parameters": [ { "type": "string", "description": "序列号", "name": "serialNumber", "in": "path", "required": true }, { "description": "二维码数据", "name": "qrCodeData", "in": "body", "schema": { "$ref": "#/definitions/models.QRCodeDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.QRCodeResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/employee-serials/{serialNumber}/query": { "get": { "description": "查询指定员工序列号的详细信息", "produces": [ "application/json" ], "tags": [ "员工赋码查询" ], "summary": "查询员工序列号信息", "parameters": [ { "type": "string", "description": "序列号", "name": "serialNumber", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/employee-serials/{serialNumber}/revoke": { "post": { "security": [ { "BearerAuth": [] } ], "description": "吊销指定员工序列号", "produces": [ "application/json" ], "tags": [ "员工赋码管理" ], "summary": "吊销员工序列号", "parameters": [ { "type": "string", "description": "序列号", "name": "serialNumber", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.BaseResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/employees": { "get": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "员工管理" ], "summary": "员工列表", "parameters": [ { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "limit", "in": "query" }, { "type": "string", "description": "角色筛选", "name": "role", "in": "query" }, { "type": "string", "description": "搜索", "name": "search", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.PaginationResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "员工管理" ], "summary": "创建员工", "parameters": [ { "description": "员工数据", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.CreateUserDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/employees/{id}": { "delete": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "员工管理" ], "summary": "删除员工", "parameters": [ { "type": "integer", "description": "用户 ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.BaseResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } }, "patch": { "security": [ { "BearerAuth": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "员工管理" ], "summary": "更新员工", "parameters": [ { "type": "integer", "description": "用户 ID", "name": "id", "in": "path", "required": true }, { "description": "更新数据", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.UpdateUserDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/employees/{id}/reset-password": { "post": { "security": [ { "BearerAuth": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "员工管理" ], "summary": "重置密码", "parameters": [ { "type": "integer", "description": "用户 ID", "name": "id", "in": "path", "required": true }, { "description": "新密码", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.AdminResetPasswordDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.BaseResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/serials": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取序列号列表,支持分页和搜索", "produces": [ "application/json" ], "tags": [ "序列号管理" ], "summary": "获取序列号列表", "parameters": [ { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": " ", "name": "limit", "in": "query" }, { "type": "string", "description": "搜索关键词", "name": "search", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.PaginationResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/serials/generate": { "post": { "security": [ { "BearerAuth": [] } ], "description": "生成指定数量的序列号", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "序列号管理" ], "summary": "生成序列号", "parameters": [ { "description": "生成数据", "name": "generateData", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.GenerateSerialDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/serials/generate-with-prefix": { "post": { "security": [ { "BearerAuth": [] } ], "description": "生成带有指定前缀的序列号", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "序列号管理" ], "summary": "带前缀生成序列号", "parameters": [ { "description": "生成数据", "name": "generateData", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.GenerateWithPrefixDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/serials/{serialNumber}": { "put": { "security": [ { "BearerAuth": [] } ], "description": "更新指定序列号的信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "序列号管理" ], "summary": "更新序列号信息", "parameters": [ { "type": "string", "description": "序列号", "name": "serialNumber", "in": "path", "required": true }, { "description": "更新数据", "name": "updateData", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.UpdateSerialDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/serials/{serialNumber}/qrcode": { "post": { "security": [ { "BearerAuth": [] } ], "description": "为指定序列号生成查询二维码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "序列号管理" ], "summary": "生成二维码", "parameters": [ { "type": "string", "description": "序列号", "name": "serialNumber", "in": "path", "required": true }, { "description": "二维码数据", "name": "qrCodeData", "in": "body", "schema": { "$ref": "#/definitions/models.QRCodeDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.QRCodeResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/serials/{serialNumber}/query": { "get": { "description": "查询指定序列号的详细信息", "produces": [ "application/json" ], "tags": [ "序列号查询" ], "summary": "查询序列号信息", "parameters": [ { "type": "string", "description": "序列号", "name": "serialNumber", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/serials/{serialNumber}/revoke": { "post": { "security": [ { "BearerAuth": [] } ], "description": "吊销指定序列号", "produces": [ "application/json" ], "tags": [ "序列号管理" ], "summary": "吊销序列号", "parameters": [ { "type": "string", "description": "序列号", "name": "serialNumber", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.BaseResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/users/assignable": { "get": { "security": [ { "BearerAuth": [] } ], "description": "用于售后工单分配选择技术员/管理员,无需分页", "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取可分配用户列表", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.DataResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } } }, "definitions": { "models.AdminResetPasswordDTO": { "type": "object", "required": [ "newPassword" ], "properties": { "newPassword": { "type": "string", "minLength": 6 } } }, "models.BaseResponse": { "type": "object", "properties": { "message": { "type": "string" } } }, "models.ChangePasswordDTO": { "type": "object", "required": [ "currentPassword", "newPassword" ], "properties": { "currentPassword": { "type": "string" }, "newPassword": { "type": "string", "minLength": 6 } } }, "models.Company": { "type": "object", "properties": { "companyName": { "type": "string" }, "createdAt": { "type": "string" }, "id": { "type": "integer" }, "isActive": { "type": "boolean" }, "updatedAt": { "type": "string" } } }, "models.CompanyDataRequest": { "type": "object", "required": [ "companyName" ], "properties": { "companyName": { "type": "string" } } }, "models.CompanyResponse": { "type": "object", "properties": { "company": { "$ref": "#/definitions/models.Company" }, "message": { "type": "string" } } }, "models.CompanyUpdateRequest": { "type": "object", "properties": { "companyName": { "type": "string" }, "isActive": { "type": "boolean" } } }, "models.CreateAftersalesOrderDTO": { "type": "object", "required": [ "companyAddress", "companyName", "contactName", "contactPhone", "issueDescription", "serviceType" ], "properties": { "companyAddress": { "type": "string" }, "companyName": { "type": "string" }, "contactName": { "type": "string" }, "contactPhone": { "type": "string" }, "issueDescription": { "type": "string" }, "serviceType": { "type": "string", "enum": [ "software", "hardware", "maintenance" ] }, "technicianId": { "type": "integer" } } }, "models.CreateUserDTO": { "type": "object", "required": [ "employeeNo", "name", "phone", "position", "role" ], "properties": { "email": { "type": "string" }, "employeeNo": { "type": "string" }, "name": { "type": "string" }, "password": { "type": "string" }, "phone": { "type": "string" }, "position": { "type": "string" }, "role": { "type": "string", "enum": [ "admin", "technician", "employee" ] }, "username": { "type": "string" } } }, "models.CustomerConfirmDTO": { "type": "object", "required": [ "action" ], "properties": { "action": { "type": "string", "enum": [ "authorize", "reject" ] }, "rejectReason": { "type": "string" }, "signature": { "type": "string" } } }, "models.DataResponse": { "type": "object", "properties": { "data": {}, "message": { "type": "string" } } }, "models.EmployeeSerial": { "type": "object", "properties": { "company": { "$ref": "#/definitions/models.Company" }, "companyName": { "type": "string" }, "createdAt": { "type": "string" }, "createdBy": { "type": "integer" }, "employee": { "$ref": "#/definitions/models.User" }, "employeeId": { "type": "integer" }, "employeeName": { "type": "string" }, "id": { "type": "integer" }, "isActive": { "type": "boolean" }, "position": { "type": "string" }, "serialNumber": { "type": "string" }, "updatedAt": { "type": "string" }, "user": { "$ref": "#/definitions/models.User" } } }, "models.ErrorResponse": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } } }, "models.GenerateEmployeeSerialDTO": { "type": "object", "required": [ "companyName", "employeeName", "position" ], "properties": { "companyName": { "type": "string" }, "employeeName": { "type": "string" }, "position": { "type": "string" }, "quantity": { "type": "integer", "maximum": 1000, "minimum": 1 }, "serialPrefix": { "type": "string" } } }, "models.GenerateSerialDTO": { "type": "object", "required": [ "companyName" ], "properties": { "companyName": { "type": "string" }, "quantity": { "type": "integer", "maximum": 1000, "minimum": 1 }, "validDays": { "type": "integer", "maximum": 3650, "minimum": 1 } } }, "models.GenerateWithPrefixDTO": { "type": "object", "required": [ "companyName" ], "properties": { "companyName": { "type": "string" }, "quantity": { "type": "integer", "maximum": 1000, "minimum": 1 }, "serialPrefix": { "type": "string" }, "validDays": { "type": "integer", "maximum": 3650, "minimum": 1 } } }, "models.LoginDTO": { "type": "object", "required": [ "password", "username" ], "properties": { "password": { "type": "string", "minLength": 6 }, "username": { "type": "string" } } }, "models.LoginResponse": { "type": "object", "properties": { "accessToken": { "type": "string" }, "message": { "type": "string" }, "user": { "$ref": "#/definitions/models.UserDTO" } } }, "models.Pagination": { "type": "object", "properties": { "limit": { "type": "integer" }, "page": { "type": "integer" }, "total": { "type": "integer" }, "totalPages": { "type": "integer" } } }, "models.PaginationResponse": { "type": "object", "properties": { "data": {}, "message": { "type": "string" }, "pagination": { "$ref": "#/definitions/models.Pagination" } } }, "models.QRCodeDTO": { "type": "object", "properties": { "baseUrl": { "type": "string" } } }, "models.QRCodeResponse": { "type": "object", "properties": { "message": { "type": "string" }, "qrCodeData": { "type": "string" }, "queryUrl": { "type": "string" } } }, "models.ReassignAftersalesDTO": { "type": "object", "required": [ "technicianId" ], "properties": { "technicianId": { "type": "integer" } } }, "models.SubmitForConfirmationDTO": { "type": "object", "required": [ "resolutionNote" ], "properties": { "resolutionNote": { "type": "string" } } }, "models.UpdateAftersalesOrderDTO": { "type": "object", "properties": { "companyAddress": { "type": "string" }, "contactName": { "type": "string" }, "contactPhone": { "type": "string" }, "issueDescription": { "type": "string" }, "resolutionNote": { "type": "string" }, "serviceType": { "type": "string", "enum": [ "software", "hardware", "maintenance" ] }, "technicianId": { "type": "integer" } } }, "models.UpdateEmployeeSerialDTO": { "type": "object", "properties": { "companyName": { "type": "string" }, "employeeName": { "type": "string" }, "isActive": { "type": "boolean" }, "position": { "type": "string" } } }, "models.UpdateProfileDTO": { "type": "object", "required": [ "email", "name" ], "properties": { "email": { "type": "string" }, "name": { "type": "string" } } }, "models.UpdateSerialDTO": { "type": "object", "properties": { "companyName": { "type": "string" }, "isActive": { "type": "boolean" }, "validUntil": { "type": "string" } } }, "models.UpdateUserDTO": { "type": "object", "properties": { "email": { "type": "string" }, "employeeNo": { "type": "string" }, "name": { "type": "string" }, "phone": { "type": "string" }, "position": { "type": "string" }, "role": { "type": "string", "enum": [ "admin", "technician", "employee" ] } } }, "models.User": { "type": "object", "properties": { "createdAt": { "type": "string" }, "email": { "type": "string" }, "employeeNo": { "type": "string" }, "employeeSerials": { "type": "array", "items": { "$ref": "#/definitions/models.EmployeeSerial" } }, "id": { "type": "integer" }, "name": { "type": "string" }, "phone": { "type": "string" }, "position": { "type": "string" }, "role": { "type": "string" }, "updatedAt": { "type": "string" }, "username": { "type": "string" } } }, "models.UserDTO": { "type": "object", "properties": { "createdAt": { "type": "string" }, "email": { "type": "string" }, "employeeNo": { "type": "string" }, "employeeSerials": { "type": "array", "items": { "$ref": "#/definitions/models.EmployeeSerial" } }, "id": { "type": "integer" }, "name": { "type": "string" }, "phone": { "type": "string" }, "position": { "type": "string" }, "role": { "type": "string" }, "username": { "type": "string" } } } }, "securityDefinitions": { "BearerAuth": { "description": "Bearer token 认证", "type": "apiKey", "name": "Authorization", "in": "header" } } }