swagger: "2.0"
info:
  version: "0.0.1"
  title: 员工接口包括与老系统核心的同步接口
# during dev, should point to your local machine
host: employee.cathay-ins.com.cn
# basePath prefixes all resource paths
basePath: /
#
schemes:
  # tip: remove http to make production-grade
  - http
  - https
# format of bodies a client can send (Content-Type)
consumes:
  - application/json
# format of the responses to the client (Accepts)
produces:
  - application/json
tags:
  - name: api接口
    description: 标准api接口
  - name: 定时任务
    description: 主要处理与老系统核心进行数据同步之类的定时任务
paths:
  /api/employee:
    get:
      description: 获取员工信息
      tags:
      - api接口
      parameters:
      - name: ddUserId
        description: 用户国泰钉钉ID
        in: query
        type: string
      - name: jobNumber
        description: 员工ID
        in: query
        type: string
      - name: mobile
        description: 手机号码
        in: query
        type: string
      responses:
        200:
          description: 返回数据成功
          schema:
            # a pointer to a definition
            $ref: "#/definitions/EmployeeWidthDepartment"
        # responses may fall through to errors
        400:
          description: Error
          schema:
            $ref: "#/definitions/Error400"
  /api/employees/{jobNumber}:
    get:
      description: 获取员工基本信息
      tags:
      - api接口
      parameters:
      - name: jobNumber
        description: 国泰员工号码
        in: path
        type: string
        required: true
      responses:
        200:
          description: 返回数据成功
          schema:
            # a pointer to a definition
            $ref: "#/definitions/Employee"
        # responses may fall through to errors
        400:
          description: Error
          schema:
            $ref: "#/definitions/Error400"
  /api/departments/{departmentId}:
    get:
      description: 获取部门信息
      tags:
      - api接口
      parameters:
      - name: departmentId
        description: 国泰部门ID
        in: path
        type: string
        required: true
      responses:
        200:
          description: 返回数据成功
          schema:
            # a pointer to a definition
            $ref: "#/definitions/Department"
        # responses may fall through to errors
        400:
          description: Error
          schema:
            $ref: "#/definitions/Error400"
  /schedule/trigger-user-core2employee:
    get:
      description: 老系统核心同步员工中心
      tags:
      - 定时任务
      responses:
        200:
          description: 返回数据成功
  /schedule/trigger-user-employee2dd:
    get:
      description: 员工中心同步钉钉
      tags:
      - 定时任务
      responses:
        200:
          description: 返回数据成功
  /schedule/trigger-user-employee:
    get:
      description: 老系统核心->员工中心->钉钉
      tags:
      - 定时任务
      responses:
        200:
          description: 返回数据成功
# complex objects have schema definitions
definitions:
  Employee:
    type: object
    properties:
      jobNumber:
        type: string
        description: 国泰员工号码
      ddUserId:
        type: string
        description: 国泰钉钉ID
      name:
        type: string
        description: 姓名
      mobile:
        type: string
        description: 手机号码
      position:
        type: string
        description: 职称
      email:
        type: string
        format: email
        description: 员工邮箱
  EmployeeWidthDepartment:
    type: object
    properties:
      jobNumber:
        type: string
        description: 国泰员工号码
      ddUserId:
        type: string
        description: 国泰钉钉ID
      name:
        type: string
        description: 姓名
      mobile:
        type: string
        description: 手机号码
      position:
        type: string
        description: 职称
      email:
        type: string
        format: email
        description: 员工邮箱
      department:
        $ref: "#/definitions/Department"
  Department:
    properties:
      coreId:
        type: string
        description: 老系统核心中的department ID
      coreParentId:
        type: string
        description: 老系统核心中的父department ID
      name:
        type: string
        description: 部门名称
      count:
        type: number
        description: 部门员工数量
  Error400:
    required:
      - code
      - message
    properties:
      code:
        type: string
        description: 业务出错码，请参见 http://wiki.cathay-inc.com:8090/pages/viewpage.action?pageId=68927
      message:
        type: string
