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

更新请求金蝶版本

上级 3129774e
......@@ -34,7 +34,7 @@ public class KingDeeApi {
private final String serviceNameMap = "LQKJ.WebApi.Stub.CustomWebApiService.ExecuteDynamicObject,LQKJ.WebApi.Stub";
private final String updateService = "LQKJ.WebApi.Stub.CustomWebApiService.ExecutBatch,LQKJ.WebApi.Stub";
private final String upAttachment = "LQKJ.WebApi.Stub.CustomWebApiService.HttpDownloadFile,LQKJ.WebApi.Stub";
private ExecutorService threadPool = new ThreadPoolExecutor(10, 10,
......@@ -127,7 +127,7 @@ public class KingDeeApi {
}
return "";
}
/**
* 查询单据体
*/
......@@ -179,36 +179,35 @@ 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);
Map<String, Object> requestData = new HashMap<String, Object>();
requestData.put("http", data);
String response = "";
try {
response = kingDeeK3CloudApi.execute(upAttachment, new Object[]{data}, String.class);
} catch (Exception e) {
String response = "";
try {
response = kingDeeK3CloudApi.execute(upAttachment, new Object[]{data}, String.class);
} catch (Exception e) {
e.printStackTrace();
//productLogUtil.productSyncErrorLogCreate(Integer.valueOf(config.get("productId")), queueId, config.get("name"), config.get("docType"), config.get("direction"), "", LOGIN_MESSAGE);
}
}
return response;
return response;
}
/**
* 创建/更新
*/
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,11 +293,11 @@ 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();
e.printStackTrace();
if (index != 0) {
this.sendThirdParty(data, index - 1);
} else {
......
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论