From c78998b2d5eb708b824c2bd83b2be748dfe91a17 Mon Sep 17 00:00:00 2001 From: fang <123456> Date: Tue, 12 Nov 2024 13:42:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=85=E5=8A=9E=5F1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sys/sys/midservice/utils/RequestClient.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 7d1b954..2453c63 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("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,7 +59,10 @@ public class RequestClient { */ public String callService(String url, String body) { Map header = new HashMap<>(); + header.put("clientKey", 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)) { @@ -65,9 +74,9 @@ public class RequestClient { 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; } @@ -98,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("###结束调用待办保存日志方法"); } /***