42 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Java
		
	
	
	
		
		
			
		
	
	
			42 lines
		
	
	
		
			1.4 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 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;
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |