作者:钟剑华  历史版本:1  更新时间:2024-11-20 15:41

适用版本:所有版本;
完整类名:com.lc.ibps.platform.script.script.ThridServiceScript

适用哪些服务?

  1. 通过business

调用方式例子

  • 发送post请求
java.util.Map<String, Object> data = com.lc.ibps.base.framework.helper.MapBuilder.create().a("name", "3").a("type", "org").a("level", 3).p();
String url = "http://192.168.3.190:15100/ibps/platform/v3/level/save";
java.util.Map<String, String> headers = new java.util.HashMap<>();
headers.put(com.lc.ibps.cloud.constants.ParameterKey.HEADER_AUTHORIZATION, com.lc.ibps.base.web.context.ContextUtil.getCurrentAccessToken());
thridServiceScript.doPostBodyOfRestFull(url, headers, data);

常用方法

    /**
     * 输入参数数据处理脚本
     * 
     * @param params
     * @return
     */
    public Map<String, Object> defaultResfulInput(Map<String, Object> params);

    /**
     * 输出参数数据处理脚本
     * 
     * @param data
     * @return
     */
    public List<?> defaultResfulOutput(String data);

    /**
     * 输入参数数据处理脚本
     * 
     * @param params
     * @return
     */
    public Map<String, Object> defaultWebserviceInput(Map<String, Object> params);

    /**
     * 输出参数数据处理脚本
     * 
     * @param data
     * @return
     */
    public List<?> defaultWebserviceOutput(String data);

    /**
          * 示例:
     * String data = "{\"name\":\"gg\",\"type\":\"org\",\"level\":\"43\"}";
     * thridServiceScript.saveLevelByFeign(data);
     *
     * @param data
     */
    public void saveLevelByFeign(String data);

    /**
          * 示例:
     * String data = "{\"name\":\"gg\",\"type\":\"org\",\"level\":\"43\"}";
     * String url = "http://192.168.3.220:5100/ibps/platform/v3/level/save";
     * thridServiceScript.saveLevelByHttp(data,url);
     *
     * @param data
     * @param url
     */
    public void saveLevelByHttp(String data, String url);


    /**
          * 示例:
     * <pre>
     * java.util.Map<String, Object> data = com.lc.ibps.base.framework.helper.MapBuilder.create()
     * .a("name", "3")
     * .a("type", "org")
     * .a("level", 3)
     * .p();
     * String url = "http://192.168.3.190:15100/ibps/platform/v3/level/save";
     * java.util.Map<String, String> headers = new java.util.HashMap<>();
     * headers.put(com.lc.ibps.cloud.constants.ParameterKey.HEADER_AUTHORIZATION, com.lc.ibps.base.web.context.ContextUtil.getCurrentAccessToken());
     * thridServiceScript.doPostBodyOfRestFull(url, headers, data);
     * </pre>
     * @param url
     * @param headers
     * @param body
     * @return
     */
    public Object doPostBodyOfRestFull(String url, Map<String, String> headers, Object body);

    public Object doPostUriOfRestFull(String url, Map<String, String> headers, List<NameValuePair> nameValuePairs);