38 lines
1.2 KiB
Java
38 lines
1.2 KiB
Java
|
package tqq9.lc123.cloud.app.plugin.trd;
|
|||
|
|
|||
|
import com.alibaba.fastjson.JSONObject;
|
|||
|
import kd.bos.logging.Log;
|
|||
|
import kd.bos.logging.LogFactory;
|
|||
|
import tqq9.lc123.cloud.app.plugin.utils.ConfigUtils;
|
|||
|
import tqq9.lc123.cloud.app.plugin.utils.HttpRequestUtils;
|
|||
|
|
|||
|
import java.io.IOException;
|
|||
|
import java.util.HashMap;
|
|||
|
import java.util.Map;
|
|||
|
|
|||
|
/**
|
|||
|
* 第三方接口调用
|
|||
|
*/
|
|||
|
public class TrdInterfaceImpl {
|
|||
|
|
|||
|
private static final Log logger = LogFactory.getLog(TrdInterfaceImpl.class);
|
|||
|
|
|||
|
//调用通天晓接口
|
|||
|
public static JSONObject ttxImpl(String method, String param) throws IOException {
|
|||
|
String ttx_customerId = ConfigUtils.getThirdConfigByNumber("Ttx_CustomerId");
|
|||
|
String ttx_mainUrl = ConfigUtils.getThirdConfigByNumber("Ttx_MainURL");
|
|||
|
|
|||
|
Map<String, String> headers = new HashMap<>();
|
|||
|
headers.put("method", method);
|
|||
|
headers.put("v", "2.0");
|
|||
|
headers.put("format", "xml");
|
|||
|
headers.put("customerId", ttx_customerId);
|
|||
|
|
|||
|
String response = HttpRequestUtils.postXml(ttx_mainUrl, param, headers);
|
|||
|
logger.info("ttx-responseXML:" + response);
|
|||
|
JSONObject resJSON = HttpRequestUtils.xmlToJson(response);
|
|||
|
logger.info("ttx-responseJSON:" + resJSON);
|
|||
|
return resJSON;
|
|||
|
}
|
|||
|
}
|