lc/lc123/cloud/app/plugin/trd/TtxImpl.java

42 lines
1.4 KiB
Java
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package tqq9.lc123.cloud.app.plugin.trd;
import com.alibaba.fastjson.JSONObject;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import org.apache.commons.lang3.StringUtils;
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 TtxImpl {
private static final Log logger = LogFactory.getLog(TtxImpl.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);
if(StringUtils.isNotBlank(response)){
JSONObject resJSON = HttpRequestUtils.xmlToJson(response);
logger.info("ttx-responseJSON" + resJSON);
return resJSON;
}
return null;
}
}