版本比较

标识

  • 该行被添加。
  • 该行被删除。
  • 格式已经改变。

目录

介绍机器人

token已无效化处理

1.HCM机器人所在位置

系统设置 → > 基础服务 →> 机器人设置

2.HCM机器人存在背景

HCM机器人可实现连式任务调度,在页面上想看到进度条的任务调度,想实现云函数的逻辑但是又不会写云函数,想仅仅通过配置即可达到云函数的效果,

3.HCM机器人 特点

特点:

1.其特点在于 对于单个机器人 任务有顺序执行, 单条链路执行不可分叉,不可同步

...

7.上下文 包含哪些参数?  1.传入的params, 2.机器人脚本里面的context, 3.self.context (这里面可就丰富了 当前登录人信息,权限,公司信息,等等)


4.配置 说明

  1. action 配置
代码块
languagejson
themeMidnight
titleaction 配置示例一
{
    "actions": [{
        "action": "SHORTCUT",
        "condition": "MULTI_ITEM",
        "label": "test1",
        "key": "test1",
        "options": {
            "name": "机器人脚本示例",   #机器人名称用于确定使用的是那个机器人
            "params": "=function(params){let _ret={items:params.selected.map(v=>v.id)};return _ret}" #params 将作为参数加入到上下文
        }
    }]
}
代码块
languagejson
themeMidnight
titleaction 配置示例二
{
            "key": "exec",
            "action": "CALC",
            "condition": "ITEM",
            "label": "test2",
            "api": "hcm.shortcut.exec",
            "params": "=(context)=>{return {shortcut_id:3,params:{'a':1}}}" #shortcut_id 作为确定是那个机器人也可以换成name,这样也可以确定机器人,内部的params将作为参数加入到上下文
        }



参数名类型说明
shortcut_id
intHCM机器人ID
params
dict传入参数
namestr机器人名称
stages
list如果不为None 那么只会执行这个列表内的任务


以上我们说明了 机器人在元数据的配置, 两个示例都可使用,那么接下来将对 机器人脚本进行说明

2.脚本配置参数

脚本配置参数路径类型说明
stageslist任务list,里面包含了多个任务的详细信息,每个任务对应一个dict
contextdict脚本预制上下文
returnlist返回值字典
stages.metadict单个任务接口信息需要 name (接口名称)和 param (接口参数)在Message引擎下 有to(目标人ID,缺省发给自己) 和context(消息内容) 两个参数
stages.namestr单个任务名称 会在执行过程中提示任务执行情况
stages.enginestr任务接口引擎
OpenAPI:本系统接口。
RemoteAPI:外系统接口 使用这个引擎 stages.meta 里面需要有url 和token 
Shortcut:调用其他的HCM机器人,在这里stages.meta.name 是其他机器人的名称,
Message:发送消息 这个引擎下stages.meta 
有两个参数 to (发送消息目标人的ID,没有这个参数时发给自己)context 发送内容
stages.outputdict本任务执行结束输出的内容包含两个参数message 页面消息提示 ,context 类型为dict (本任务结束将一些参数放入上下文中)
stages.iterator表达式/可迭代对象根据迭代对象 循环执行

ITER_V 特定写法stages.iterator 单元值

ITER_I 特定写法stages.iterator 单元值 的index   比如list 的index

stages.parallel表达式/可迭代对象根据迭代对象 循环执行加入队列

ITER_V 特定写法stages.iterator 单元值

ITER_I 特定写法stages.iterator 单元值 的index   比如list 的index

stages.queuestr只有定义了stages.parallel 才有用到意思是在什么队列执行缺省
shortcut队列

stages.errordict任务执行失败需要的操作

包含两个参数 ignore 执行失败 是否跳过,跳过就继续执行下面的任务,不跳过整个将结束,没有这个参数也将直接结束

context 是将一些参数 放入上下文中 在这里  err 为报错堆栈信息 固定写法

stages.condition表达式/boolean是否跳过此任务

3. 脚本配置 示例

代码块
languagejson
themeMidnight
titleHCM机器人脚本示例一
{
  "return": {
    "x_mobile": "=x_mobile"
  },
  "stages": [{
    "meta": {
      "url": "https://xxxxxx.hcmcloud.cn",
      "name": "hcm.model.list",
      "param": {
        "model": "Employee",
        "filter_dict": {
          "name": "李XX"
        }
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "取外部数据",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "x_ID": "=ret['list'][0]['id']"
      },
      "message": "='共{}条记录'.format(ret['count'])"
    }
  }, {
    "meta": {
      "name": "hcm.model.get",
      "param": {
        "id_": "=x_ID",
        "model": "Employee"
      }
    },
    "name": "查看本系统是否有该数据",
    "error": {
      "ignore": true,
      "context": {
        "is_error": true,
        "get_mobile_error": "=err"
      }
    },
    "engine": "OpenAPI",
    "output": {
      "context": {
        "is_error": false,
        "employee_id": "=ret['list'][0]['id']"
      },
      "message": "='共{}条记录'.format(ret['count'])"
    }
  }, {
    "meta": {
      "name": "hcm.model.create",
      "param": {
        "info": {
          "name": "机器人测试日志",
          "type": 2,
          "content": {
            "get_mobile_error": "=str(get_mobile_error)"
          }
        },
        "model": "SyncOuterRecord"
      }
    },
    "name": "记录日志",
    "engine": "OpenAPI",
    "output": {},
    "condition": "=is_error"
  }, {
    "meta": {
      "name": "HCM机器人迭代模式",
      "param": {}
    },
    "name": "调用其他机器人",
    "engine": "Shortcut"
  }, {
    "meta": {
      "context": "本次HCM机器人演示成功",
      "to":12212
    },
    "name": "发送消息",
    "engine": "Message"
  }],
  "context": {}
}  

...

代码块
languagejson
themeMidnight
titleHCM机器人示例三 异步模式
{
    "stages": [{
        "meta": {
            "name": "hcm.model.list",
            "param": {
                "model": "common_basic_item_data.语种",
                "page_size": 999
            }
        },
        "name": "部署元数据",
        "engine": "OpenAPI",
        "output": {
            "context": {
                "basic_item_info": "=ret['list']"
            },
            "message": "='共获取{}条数据'.format(len(ret['list']))"
        }
    }, {
        "meta": {
            "name": "hcm.model.edit",
            "param": {
                "id_": "=ITER_V['id']",
                "info": {
                    "description": "='第一次{}'.format(ITER_V['name'])"
                },
                "model": "common_basic_item_data.语种"
            }
        },
        "name": "循环编辑代码项",
        "queue": "syn",
        "engine": "OpenAPI",
        "output": {
            "message": "='编辑代码项{}完成'.format(ret['name'])"
        },
        "parallel": "=basic_item_info"
    }]
}


中建机器人初始化环境配置示例

  • 删除标准初始化内容、包括码表、人事事务、用工类型、岗位状态等(company_clear_item为自定义云函数,进行删除逻辑)


代码块
linenumberstrue
collapsetrue
{
    "stages": [{
        "meta": {
            "name": "private.company_clear_item",
            "param": {
                "test": 123
            }
        },
        "name": "删除标准初始化内容",
        "engine": "OpenAPI",
        "output": {
            "context": {},
            "message": "=删除删除标准初始化内容完成"
        }
    }]
}


  • 从管控租户初始化云函数到该租户

代码块
linenumberstrue
collapsetrue
{
  "stages": [{
    "meta": {
      "url": "https://hr1.c111c.com",
      "name": "hcm.model.list",
      "param": {
        "model": "HCMBizStore",
        "page_size": 100,
        "filter_dict": {
          "model": "DynamicScriptList"
        }
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取云函数列表",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_ids": "=list(map(lambda x:x['id'],ret['list']))"
      },
      "message": "='共{}条记录'.format(ret['count'])"
    }
  }, {
    "meta": {
      "url": "https://hr1.c111c.com",
      "name": "hcm.model.action",
      "param": {
        "id_": "=ITER_V",
        "model": "BizStore",
        "action": "get_package"
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取包Index",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_idxs": "=list(map(lambda x:x['index'],ret))"
      },
      "message": "='共获取{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_ids"
  }, {
    "meta": {
      "name": "dynamic.function.tpl.deploy",
      "param": {
        "tpl_index": "=ITER_V"
      }
    },
    "name": "部署云函数",
    "engine": "OpenAPI",
    "output": {
      "message": "='共部署{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_idxs"
  }]
}


  • 从管控租户初始化元数据到该租户

代码块
linenumberstrue
collapsetrue
{
  "stages": [{
    "meta": {
      "url": "https://hr1.c111c.com",
      "name": "hcm.model.list",
      "param": {
        "model": "HCMBizStore",
        "page_size": 10000,
        "filter_dict": {
          "model": "CompanyInitSingleItem",
          "status": 1
        }
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取元数据列表",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_ids": "=list(map(lambda x:x['id'],ret['list']))"
      },
      "message": "='共{}条记录'.format(ret['count'])"
    }
  }, {
    "meta": {
      "url": "https://hr1.c111c.com",
      "name": "hcm.model.action",
      "param": {
        "id_": "=ITER_V",
        "model": "BizStore",
        "action": "get_package"
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取包Index",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_idxs": "=list(map(lambda x:x['index'],ret))"
      },
      "message": "='共获取{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_ids"
  }, {
    "meta": {
      "name": "hcm.paas.object.tpl.deploy",
      "model": "Metadata",
      "param": {
        "tpl_index": "=ITER_V"
      }
    },
    "name": "部署元数据",
    "engine": "OpenAPI",
    "output": {
      "message": "='共部署{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_idxs"
  }]
}
  • 从管控租户初始化公司级模版到该租户

代码块
linenumberstrue
collapsetrue
{
  "stages": [{
    "meta": {
      "url": "https://22r.12313c.com",
      "name": "hcm.model.list",
      "param": {
        "model": "HCMBizStore",
        "page_size": 10000,
        "filter_dict": {
          "model": "HCMTemplate",
          "status": 1
        }
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取公司级模版列表",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_ids": "=list(map(lambda x:x['id'],ret['list']))"
      },
      "message": "='共{}条记录'.format(ret['count'])"
    }
  }, {
    "meta": {
      "url": "https://22r.12313c.com",
      "name": "hcm.model.action",
      "param": {
        "id_": "=ITER_V",
        "model": "BizStore",
        "action": "get_package"
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取包Index",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_idxs": "=list(map(lambda x:x['index'],ret))"
      },
      "message": "='共获取{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_ids"
  }, {
    "meta": {
      "name": "hcm.template.tpl.deploy",
      "param": {
        "tpl_index": "=ITER_V"
      }
    },
    "name": "部署公司级模版",
    "engine": "OpenAPI",
    "output": {
      "message": "='共部署{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_idxs"
  }]
}
  • 从管控租户初始化人员信息集场景到该租户

代码块
linenumberstrue
collapsetrue
{
  "stages": [{
    "meta": {
      "url": "https://22r.12313c.com",
      "name": "hcm.model.list",
      "param": {
        "model": "HCMBizStore",
        "page_size": 10000,
        "filter_dict": {
          "model": "SubSetApplyState",
          "status": 1
        }
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取信息集列表",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_ids": "=list(map(lambda x:x['id'],ret['list']))"
      },
      "message": "='共{}条记录'.format(ret['count'])"
    }
  }, {
    "meta": {
      "url": "https://22r.12313c.com",
      "name": "hcm.model.action",
      "param": {
        "id_": "=ITER_V",
        "model": "BizStore",
        "action": "get_package"
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取包Index",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_idxs": "=list(map(lambda x:x['index'],ret))"
      },
      "message": "='共获取{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_ids"
  }, {
    "meta": {
      "name": "hcm.model.tpl.deploy",
      "param": {
        "model": "SubSetApplyState",
        "tpl_index": "=ITER_V"
      }
    },
    "name": "获取信息集列表",
    "engine": "OpenAPI",
    "output": {
      "message": "='共部署{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_idxs"
  }]
}
  • 从管控租户初始化列表代码项到该租户

代码块
linenumberstrue
collapsetrue
{
  "stages": [{
    "meta": {
      "url": "https://h23.1231312.com",
      "name": "hcm.model.list",
      "param": {
        "model": "HCMBizStore",
        "page_size": 10000,
        "filter_dict": {
          "model": "CommonBasicItemCategory",
          "status": 1
        }
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取列表代码项",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_ids": "=list(map(lambda x:x['id'],ret['list']))"
      },
      "message": "='共{}条记录'.format(ret['count'])"
    }
  }, {
    "meta": {
      "url": "https://h23.1231312.com",
      "name": "hcm.model.action",
      "param": {
        "id_": "=ITER_V",
        "model": "BizStore",
        "action": "get_package"
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取包Index",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_idxs": "=list(map(lambda x:x['index'],ret))"
      },
      "message": "='共获取{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_ids"
  }, {
    "meta": {
      "name": "hcm.model.tpl.deploy",
      "param": {
        "model": "CommonBasicItemCategory",
        "tpl_index": "=ITER_V"
      }
    },
    "name": "获取列表代码项",
    "engine": "OpenAPI",
    "output": {
      "message": "='共部署{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_idxs"
  }]
}
  • 从管控租户初始化树形代码项到该租户

代码块
linenumberstrue
collapsetrue
{
  "stages": [{
    "meta": {
      "url": "https://h23.1231312.com",
      "name": "hcm.model.list",
      "param": {
        "model": "HCMBizStore",
        "page_size": 10000,
        "filter_dict": {
          "model": "CommonBasicItemCategoryTree",
          "status": 1
        }
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取树形列表代码项",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_ids": "=list(map(lambda x:x['id'],ret['list']))"
      },
      "message": "='共{}条记录'.format(ret['count'])"
    }
  }, {
    "meta": {
      "url": "https://h23.1231312.com",
      "name": "hcm.model.action",
      "param": {
        "id_": "=ITER_V",
        "model": "BizStore",
        "action": "get_package"
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取包Index",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_idxs": "=list(map(lambda x:x['index'],ret))"
      },
      "message": "='共获取{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_ids"
  }, {
    "meta": {
      "name": "hcm.model.tpl.deploy",
      "param": {
        "model": "CommonBasicItemCategoryTree",
        "tpl_index": "=ITER_V"
      }
    },
    "name": "获取树形列表代码项",
    "engine": "OpenAPI",
    "output": {
      "message": "='共部署{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_idxs"
  }]
}
  • 从管控租户初始化用工类型到该租户

代码块
linenumberstrue
collapsetrue
{
  "stages": [{
    "meta": {
      "url": "https://1233.c1232132.com",
      "name": "hcm.model.list",
      "param": {
        "model": "HCMBizStore",
        "page_size": 10000,
        "filter_dict": {
          "model": "EmployeeCategory",
          "status": 1
        }
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取用工类型",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_ids": "=list(map(lambda x:x['id'],ret['list']))"
      },
      "message": "='共{}条记录'.format(ret['count'])"
    }
  }, {
    "meta": {
      "url": "https://1233.c1232132.com",
      "name": "hcm.model.action",
      "param": {
        "id_": "=ITER_V",
        "model": "BizStore",
        "action": "get_package"
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取包Index",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_idxs": "=list(map(lambda x:x['index'],ret))"
      },
      "message": "='共获取{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_ids"
  }, {
    "meta": {
      "name": "hcm.model.tpl.deploy",
      "param": {
        "model": "EmployeeCategory",
        "tpl_index": "=ITER_V"
      }
    },
    "name": "获取用工类型",
    "engine": "OpenAPI",
    "output": {
      "message": "='共部署{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_idxs"
  }]
}
  • 从管控租户初始化岗位状态到该租户

代码块
linenumberstrue
collapsetrue
{
  "stages": [{
    "meta": {
      "url": "https://1233.c1232132.com",
      "name": "hcm.model.list",
      "param": {
        "model": "HCMBizStore",
        "page_size": 10000,
        "filter_dict": {
          "model": "PositionStatus",
          "status": 1
        }
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取岗位状态",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_ids": "=list(map(lambda x:x['id'],ret['list']))"
      },
      "message": "='共{}条记录'.format(ret['count'])"
    }
  }, {
    "meta": {
      "url": "https://1233.c1232132.com",
      "name": "hcm.model.action",
      "param": {
        "id_": "=ITER_V",
        "model": "BizStore",
        "action": "get_package"
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取包Index",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_idxs": "=list(map(lambda x:x['index'],ret))"
      },
      "message": "='共获取{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_ids"
  }, {
    "meta": {
      "name": "hcm.model.tpl.deploy",
      "param": {
        "model": "PositionStatus",
        "tpl_index": "=ITER_V"
      }
    },
    "name": "获取岗位状态",
    "engine": "OpenAPI",
    "output": {
      "message": "='共部署{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_idxs"
  }]
}
  • 从管控租户初始化人员信息完整度计算方案到该租户

代码块
linenumberstrue
collapsetrue
{
  "stages": [{
    "meta": {
      "url": "https://h12.3233.com",
      "name": "hcm.model.list",
      "param": {
        "model": "HCMBizStore",
        "page_size": 10000,
        "filter_dict": {
          "model": "EmpWeightProgram",
          "status": 1
        }
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取人员完整度计算方案",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_ids": "=list(map(lambda x:x['id'],ret['list']))"
      },
      "message": "='共{}条记录'.format(ret['count'])"
    }
  }, {
    "meta": {
      "url": "https://h12.3233.com",
      "name": "hcm.model.action",
      "param": {
        "id_": "=ITER_V",
        "model": "BizStore",
        "action": "get_package"
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取包Index",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_idxs": "=list(map(lambda x:x['index'],ret))"
      },
      "message": "='共获取{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_ids"
  }, {
    "meta": {
      "name": "hcm.model.tpl.deploy",
      "param": {
        "model": "EmpWeightProgram",
        "tpl_index": "=ITER_V"
      }
    },
    "name": "获取人员完整度计算方案",
    "engine": "OpenAPI",
    "output": {
      "message": "='共部署{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_idxs"
  }]
}
  • 从管控租户初始化数据校验方案到该租户

代码块
linenumberstrue
collapsetrue
{
  "stages": [{
    "meta": {
      "url": "https://h12.3233.com",
      "name": "hcm.model.list",
      "param": {
        "model": "HCMBizStore",
        "page_size": 10000,
        "filter_dict": {
          "model": "EmployeeCheckerProgram",
          "status": 1
        }
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取数据校验方案",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_ids": "=list(map(lambda x:x['id'],ret['list']))"
      },
      "message": "='共{}条记录'.format(ret['count'])"
    }
  }, {
    "meta": {
      "url": "https://h12.3233.com",
      "name": "hcm.model.action",
      "param": {
        "id_": "=ITER_V",
        "model": "BizStore",
        "action": "get_package"
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取包Index",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_idxs": "=list(map(lambda x:x['index'],ret))"
      },
      "message": "='共获取{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_ids"
  }, {
    "meta": {
      "name": "hcm.model.tpl.deploy",
      "param": {
        "model": "EmployeeCheckerProgram",
        "tpl_index": "=ITER_V"
      }
    },
    "name": "获取数据校验方案",
    "engine": "OpenAPI",
    "output": {
      "message": "='共部署{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_idxs"
  }]
}
  • 从管控租户初始化人事事务到该租户

代码块
linenumberstrue
collapsetrue
{
  "stages": [{
    "meta": {
      "url": "https://ds.111121e.com",
      "name": "hcm.model.list",
      "param": {
        "model": "HCMBizStore",
        "page_size": 10000,
        "filter_dict": {
          "model": "EmployeeAction",
          "status": 1
        }
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取人事事务",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_ids": "=list(map(lambda x:x['id'],ret['list']))"
      },
      "message": "='共{}条记录'.format(ret['count'])"
    }
  }, {
    "meta": {
      "url": "https://ds.111121e.com",
      "name": "hcm.model.action",
      "param": {
        "id_": "=ITER_V",
        "model": "BizStore",
        "action": "get_package"
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取包Index",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_idxs": "=list(map(lambda x:x['index'],ret))"
      },
      "message": "='共获取{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_ids"
  }, {
    "meta": {
      "name": "hcm.model.tpl.deploy",
      "param": {
        "model": "EmployeeAction",
        "tpl_index": "=ITER_V"
      }
    },
    "name": "获取人事事务",
    "engine": "OpenAPI",
    "output": {
      "message": "='共部署{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_idxs"
  }]
}
  • 从管控租户初始化人员信息集管理到该租户

代码块
linenumberstrue
collapsetrue
{
  "stages": [{
    "meta": {
      "url": "https://ds.111121e.com",
      "name": "hcm.model.list",
      "param": {
        "model": "HCMBizStore",
        "page_size": 10000,
        "filter_dict": {
          "model": "SubSetInformation",
          "status": 1
        }
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取人员信息集管理",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_ids": "=list(map(lambda x:x['id'],ret['list']))"
      },
      "message": "='共{}条记录'.format(ret['count'])"
    }
  }, {
    "meta": {
      "url": "https://ds.111121e.com",
      "name": "hcm.model.action",
      "param": {
        "id_": "=ITER_V",
        "model": "BizStore",
        "action": "get_package"
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取包Index",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_idxs": "=list(map(lambda x:x['index'],ret))"
      },
      "message": "='共获取{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_ids"
  }, {
    "meta": {
      "name": "hcm.model.tpl.deploy",
      "param": {
        "model": "SubSetInformation",
        "tpl_index": "=ITER_V"
      }
    },
    "name": "获取人员信息集管理",
    "engine": "OpenAPI",
    "output": {
      "message": "='共部署{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_idxs"
  }]
}
  • 从管控租户初始化自定义应用到该租户

代码块
linenumberstrue
collapsetrue
{
  "stages": [{
    "meta": {
      "url": "https://hdss.cewdad.com",
      "name": "hcm.model.list",
      "param": {
        "model": "HCMBizStore",
        "page_size": 10000,
        "filter_dict": {
          "model": "HCMCustomerApplication",
          "status": 1
        }
      },
      "token": "hcmxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "name": "获取自定义应用",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_ids": "=list(map(lambda x:x['id'],ret['list']))"
      },
      "message": "='共{}条记录'.format(ret['count'])"
    }
  }, {
    "meta": {
      "url": "https://hdss.cewdad.com",
      "name": "hcm.model.action",
      "param": {
        "id_": "=ITER_V",
        "model": "BizStore",
        "action": "get_package"
      },
      "token": "hcm9cec1f0941221dfe3fvrbes"
    },
    "name": "获取包Index",
    "engine": "RemoteAPI",
    "output": {
      "context": {
        "tpl_idxs": "=list(map(lambda x:x['index'],ret))"
      },
      "message": "='共获取{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_ids"
  }, {
    "meta": {
      "name": "hcm.model.tpl.deploy",
      "param": {
        "model": "HCMCustomerApplication",
        "tpl_index": "=ITER_V"
      }
    },
    "name": "获取自定义应用",
    "engine": "OpenAPI",
    "output": {
      "message": "='共部署{}个Index'.format(len(ret))"
    },
    "iterator": "=tpl_idxs"
  }]
}
  • 关闭无用的应用,通过自己编写云函数执行,保持开通最新的应用

代码块
linenumberstrue
collapsetrue
{
    "stages": [{
        "meta": {
            "name": "private.HCMApplicationClose",
            "param": {
                "test": 123
            }
        },
        "name": "关闭应用云函数",
        "engine": "OpenAPI",
        "output": {
            "context": {},
            "message": "=关闭应用云函数"
        }
    }]
}

...