diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/utils/RequestClient.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/utils/RequestClient.java index 446b0a5..414c1a8 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/utils/RequestClient.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/utils/RequestClient.java @@ -1,11 +1,13 @@ package shkd.sys.sys.midservice.utils; import com.alibaba.fastjson.JSON; +import com.bes.mq.org.apache.commons.codec.digest.DigestUtils; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.bos.util.HttpClientUtils; import kd.bos.util.StringUtils; +import kd.ebg.aqap.banks.srcb.dc.services.utils.SmUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -27,11 +29,15 @@ public class RequestClient { private String protocal;//http private String ip;// 域名 private String port;// 端口 + private String clientKey;// clientKey + private String clientSecret_scict;// clientSecret-scict private RequestClient() { - this.protocal = System.getProperty("efms.midservice.protocal"); - this.ip = System.getProperty("efms.midservice.ip"); - this.port = System.getProperty("efms.midservice.port"); + this.protocal = System.getProperty("backlog-protocal"); + this.ip = System.getProperty("backlog-ip"); + this.port = System.getProperty("backlog-port"); + this.clientKey= System.getProperty("clientKey-scict"); + this.clientSecret_scict= System.getProperty("clientSecret-scict"); } /** * 获取中台服务客户端实例 @@ -53,20 +59,24 @@ public class RequestClient { */ public String callService(String url, String body) { Map header = new HashMap<>(); + header.put("systemid", this.clientKey); + header.put("sign",this.clientSecret_scict); header.put("Content-Type", "application/x-www-form-urlencoded"); + // header.put("Content-Type", "application/json; charset=utf-8"); StringBuffer urlStr = new StringBuffer(); urlStr.append(this.protocal).append("://").append(this.ip); if (!StringUtils.isEmpty(this.port)) { urlStr.append(":").append(this.port); } + logger.info("环境参数,protocal:"+this.protocal+",ip:"+this.ip+",this.port:"+this.port); urlStr.append(url); String responseText = null; try { //直接POST请求 responseText = HttpClientUtils.postjson(urlStr.toString(), header, body); - logger.info(String.format("###调用接口成功,请求URL:%s,请求Header:%s,请求Body:%s,响应报文:%s", url, JSON.toJSONString(header), body, responseText)); + logger.info(String.format("###调用接口成功,请求URL:%s,请求Header:%s,请求Body:%s,响应报文:%s", urlStr, JSON.toJSONString(header), body, responseText)); } catch (IOException e) { - logger.error(String.format("###调用接口异常:%s,请求URL:%s,请求Header:%s,请求Body:%s", e.getMessage(), url, JSON.toJSONString(header), body), e); + logger.error(String.format("###调用接口异常:%s,请求URL:%s,请求Header:%s,请求Body:%s", e.getMessage(), urlStr, JSON.toJSONString(header), body), e); } return responseText; } @@ -87,7 +97,9 @@ public class RequestClient { urlStr.append(":").append(this.port); } urlStr.append(url);; + logger.info("保存时,环境参数,protocal:"+this.protocal+",ip:"+this.ip+",this.port:"+this.port); DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject("shkd_backlog"); + logger.info("保存日志表id"+dynamicObject.getPkValue()); dynamicObject.set("shkd_url",urlStr); dynamicObject.set("shkd_request",title); dynamicObject.set("shkd_request_tag",jsonMessage); @@ -95,6 +107,7 @@ public class RequestClient { dynamicObject.set("shkd_response",result); dynamicObject.set("shkd_status","0"); SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); + logger.info("保存日志表id"+dynamicObject.getPkValue()); logger.info("###结束调用待办保存日志方法"); } /***