提交 a5d30383 authored 作者: 李炎's avatar 李炎

更新请求金蝶版本

上级 3129774e
......@@ -179,12 +179,12 @@ public class KingDeeApi {
/**
* 上传附件
*
* @param attachment
* @param Id
* @return
*/
public String uploadAttachment(String attachment, long Id)
{
public String uploadAttachment(String attachment, long Id) {
Map<String, Object> data = new HashMap<String, Object>();
data.put("url", receiveAddress.split("/wx/")[0] + attachment);
data.put("id", Id);
......@@ -207,8 +207,7 @@ public class KingDeeApi {
public String kingDeeDataPush(Map<String, String> config, String queueId, String name, Map<String, Object> data) {
try {
if (this.flag) {
String response = kingDeeK3CloudApi.execute("LQKJ.WebApi.Stub.CustomWebApiService.PushAndSave,LQKJ.WebApi.Stub", new Object[]{data}, String.class);
String response = kingDeeK3CloudApi.executeObject("LQKJ.WebApi.Stub.CustomWebApiService.PushAndSave,LQKJ.WebApi.Stub", data, String.class);
//记录下推金蝶云数据的请求及响应信息
productLogUtil.productPushLogCreate(Integer.valueOf(config.get("productId")), queueId, name, config.get("docType"), config.get("direction"), JsonUtil.toString(data), response);
......@@ -224,6 +223,25 @@ public class KingDeeApi {
}
/**
* 创建/更新
*/
public String kingDeeDataPush(Map<String, Object> data) {
try {
if (this.flag) {
String response = kingDeeK3CloudApi.executeObject("LQKJ.WebApi.Stub.CustomWebApiService.PushAndSave,LQKJ.WebApi.Stub", data, String.class);
return response;
} else {
throw new KingDeeConnectException(LOGIN_MESSAGE);
}
} catch (Exception e) {
e.printStackTrace();
throw new KingDeeConnectException(LOGIN_MESSAGE);
}
}
/**
* 创建/更新 SQL
*/
public String kingDeeUpdateBySql(Map<String, String> config, String queueId, String request) {
......@@ -275,8 +293,8 @@ public class KingDeeApi {
public String sendThirdParty(String data, int index) {
try {
System.out.println("receiveAddress======="+receiveAddress);
System.out.println("data======="+data);
System.out.println("receiveAddress=======" + receiveAddress);
System.out.println("data=======" + data);
return HttpUtil.httpPost(this.receiveAddress, data).getBody();
} catch (Exception e) {
e.printStackTrace();
......
......@@ -72,7 +72,29 @@ public class KingDeeApiClient {
header.put("cookie", cookieStore);
Map<String, Object> request = new HashMap<>(1);
request.put("parameters", parameters);
request.put("pushAndSaveArgs", parameters);
String url = serverUrl + serviceName + HTTP_SUFFIX;
System.out.println("------------>" + url);
long start = System.currentTimeMillis();
ResponseEntity<String> responseEntity = HttpUtil.httpPost(url, header, JsonUtil.toString(request));
long costTime = System.currentTimeMillis() - start;
Map<String, Object> map = ThreadLocalConfig.get();
map.put("costTime", costTime);
ThreadLocalConfig.set(map);
return (T) (new SerializerProxy()).deserialize(responseEntity.getBody(), returnType);
}
@SuppressWarnings("unchecked")
public <T> T executeObject(String serviceName, Object parameters, Class<T> returnType) throws Exception {
Map<String, Object> header = new HashMap<>(1);
header.put("cookie", cookieStore);
Map<String, Object> request = new HashMap<>(1);
request.put("pushAndSaveArgs", parameters);
String url = serverUrl + serviceName + HTTP_SUFFIX;
System.out.println("------------>" + url);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论