企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 组件源码 ``` /** * <b>方法描述:</b> 容器变量拷贝 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2020-12-17 16:23:35 <br/> * * @param indict * 入参|源容器|{@link java.util.Map} * @param outdict * 入参|目标容器|{@link java.util.Map} * @param invars * 入参|拷贝变量列表|{@link List} * @param outvars * 入参|转换变量列表|{@link List} * @return 0 失败<br/> * 1 成功<br/> */ @Component(label = "容器变量拷贝", style = "判断型", type = "同步组件", comment = "将输入容器中指定变量拷贝到输出容器,根据输出key列表进行转换key,转换列表为空时,直接复制源容器key到目标容器。如果转列表不为空,必须和复制列表值对等", version = "1.0.0", deprecated = false, author = "admin", date = "2020-12-17 04:23:35") @InParams(param = {@Param(name = "indict", comment = "源容器", type = java.util.Map.class), @Param(name = "outdict", comment = "目标容器", type = java.util.Map.class), @Param(name = "invars", comment = "拷贝变量列表", type = List.class), @Param(name = "outvars", comment = "转换变量列表", type = List.class)}) @Returns(returns = {@Return(id = "0", desp = "失败"), @Return(id = "1", desp = "成功")}) @Order(value = 2) public static ResultBase P_copyVals(Map indict, Map outdict, List invars, List outvars) { if (indict == null) { return ResultBase.newFailureResult("TPTC2007", "copyVals-原参数不能为空"); } if (outdict == null) outdict = new HashMap<String, Object>(); if (invars == null || invars.isEmpty()) { invars = new JavaList(indict.keySet().toArray()); } for (int i = 0; i < invars.size(); i++) { String strKey = (String)invars.get(i); Object objVal = indict.get(strKey); if (outvars != null && outvars.size() > i) { strKey = (String)outvars.get(i); } outdict.put(strKey, objVal); } return ResultBase.newSuccessResult(); } ``` # 交易中组件使用方式 ![](https://img.kancloud.cn/1c/f3/1cf3ca7fa65ab21df32417daade700df_1870x893.png) # 参数说明及示例 ## 入口参数 源容器:一个 Map 对象,示例: `__INNER__` 目标容器:一个 Map 对象,示例: `__RSP__` 拷贝变量列表:源容器中的变量列表,示例: `["x","y"]` 转换变量列表:需要在目标容器中显示的变量列表,示例: `["x","y"]` > 注意:转换列表和拷贝列表为空时,直接复制源容器 key 到目标容器;如果转列表不为空,必须和拷贝列表值对等。