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

42 lines
1.4 KiB
Java
Raw Normal View History

package tqq9.lc123.cloud.app.plugin.trd;
import com.alibaba.fastjson.JSONObject;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
2025-09-11 02:27:02 +00:00
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);
2025-09-11 02:27:02 +00:00
if(StringUtils.isNotBlank(response)){
JSONObject resJSON = HttpRequestUtils.xmlToJson(response);
logger.info("ttx-responseJSON" + resJSON);
return resJSON;
}
return null;
}
}