|
|
@@ -4,6 +4,8 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.google.common.collect.Maps;
|
|
|
import com.kingdee.bos.dao.IObjectPK;
|
|
|
import com.kingdee.bos.util.BOSUuid;
|
|
|
import com.kingdee.eas.base.permission.UserInfo;
|
|
|
@@ -107,18 +109,24 @@ public class SYUtilsFacadeControllerBean extends AbstractSYUtilsFacadeController
|
|
|
logInfo.setBizDate(timestamp);
|
|
|
|
|
|
JSONObject paramMap = JSONUtil.parseObj(param);
|
|
|
+
|
|
|
//获取配置文件
|
|
|
Map<String,String> propt = this._getConfig(ctx);
|
|
|
+ Map signaMap = Maps.newHashMap();
|
|
|
if(StrUtil.isBlank(paramMap.getStr("timestamp"))){
|
|
|
|
|
|
- paramMap.set("timestamp",String.valueOf(timestampLong));
|
|
|
+ signaMap.put("timestamp",String.valueOf(timestampLong));
|
|
|
+ }else {
|
|
|
+ signaMap.put("timestamp",paramMap.getStr("timestamp"));
|
|
|
}
|
|
|
if(StrUtil.isBlank(paramMap.getStr("xReqNonce"))){
|
|
|
String xReqNonce = UUID.randomUUID().toString().replace("-", "");//调用者生成的 UUID(32位),结合时间戳timestamp 防重放
|
|
|
- paramMap.set("xReqNonce",xReqNonce);
|
|
|
+ signaMap.put("xReqNonce",xReqNonce);
|
|
|
+ }else {
|
|
|
+ signaMap.put("xReqNonce",paramMap.getStr("xReqNonce"));
|
|
|
}
|
|
|
param=JSONUtil.toJsonStr(paramMap);
|
|
|
- String signature = this._getSignature(ctx,propt,paramMap);
|
|
|
+ String signature = this._getSignature(ctx,propt,signaMap);
|
|
|
Map<String,String> headers = new HashMap<String,String>();
|
|
|
headers.put("appKey",propt.get("appKey"));
|
|
|
headers.put("timestamp",paramMap.getStr("timestamp"));
|
|
|
@@ -338,4 +346,53 @@ public class SYUtilsFacadeControllerBean extends AbstractSYUtilsFacadeController
|
|
|
Map map = SYUConfigUtil.getInstance().getConfig();
|
|
|
return map;
|
|
|
}
|
|
|
+//
|
|
|
+// public static void main(String[] args) throws BOSException, IOException {
|
|
|
+// SYUtilsFacadeControllerBean bean = new SYUtilsFacadeControllerBean();
|
|
|
+// bean._initConfig(null,"D:\\jingdie\\yss\\8.6v2jar\\Project_86v2\\jiuzhoutong\\config\\server\\properties\\sy\\syConfig.properties");
|
|
|
+// Map propt = bean.getConfig(null);
|
|
|
+//
|
|
|
+// OkHttpClient client = new OkHttpClient();
|
|
|
+// Long timestampLong = System.currentTimeMillis();
|
|
|
+// Map<String,String> postBody = new HashMap<>();
|
|
|
+// postBody.put("qymc","荆州九州通医药有限公司00");
|
|
|
+// postBody.put("nsrsbh","91310124834931897I");
|
|
|
+// postBody.put("areaid","310101");
|
|
|
+//// postBody.put("xReqNonce","c1fe0ae4344444979139360ad5fe5ee9");
|
|
|
+//// postBody.put("timestamp","1724899304337");
|
|
|
+// Map signaMap = Maps.newHashMap();
|
|
|
+// if(StrUtil.isBlank(postBody.get("timestamp"))){
|
|
|
+//
|
|
|
+// signaMap.put("timestamp",String.valueOf(timestampLong));
|
|
|
+// }
|
|
|
+// if(StrUtil.isBlank(postBody.get("xReqNonce"))){
|
|
|
+// String xReqNonce = UUID.randomUUID().toString().replace("-", "");//调用者生成的 UUID(32位),结合时间戳timestamp 防重放
|
|
|
+// signaMap.put("xReqNonce",xReqNonce);
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// String signature = bean._getSignature(null,propt,signaMap);
|
|
|
+// Map<String,String> headers = new HashMap<String,String>();
|
|
|
+// headers.put("appKey", (String) propt.get("appKey"));
|
|
|
+// headers.put("timestamp", (String) signaMap.get("timestamp"));
|
|
|
+// headers.put("version", (String) propt.get("version"));
|
|
|
+// headers.put("xReqNonce", (String) signaMap.get("xReqNonce"));
|
|
|
+// headers.put("signature",signature);
|
|
|
+//
|
|
|
+//
|
|
|
+// RequestBody body = RequestBody.create(MediaType.parse("application/json"), JSON.toJSONString(postBody));
|
|
|
+//
|
|
|
+// Request sYRequest = new Request.Builder()
|
|
|
+// .url(propt.get("ip")+"/gateway/iit/declare/getCompanyRegisterInfo")
|
|
|
+// .post(body).headers(Headers.of(headers))
|
|
|
+// .build();
|
|
|
+//
|
|
|
+// System.out.println("headers:"+JSON.toJSONString(headers));
|
|
|
+// Response sYResponse = client.newCall(sYRequest).execute();
|
|
|
+// if (sYResponse.body() != null) {
|
|
|
+// System.out.println(sYResponse.body().string());
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
}
|