From a7bd12fcd705f686e0ba80e39da8b67ac5ecbdf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=A0=8B?= Date: Mon, 31 Oct 2022 11:41:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=B1=BB=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interfaces/job/WorkflowSyncCronJob.java | 6 ++--- src/weaver/interfaces/util/HttpUtils.java | 22 ++++++------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/weaver/interfaces/job/WorkflowSyncCronJob.java b/src/weaver/interfaces/job/WorkflowSyncCronJob.java index f2d136b4..fb8bbc5c 100644 --- a/src/weaver/interfaces/job/WorkflowSyncCronJob.java +++ b/src/weaver/interfaces/job/WorkflowSyncCronJob.java @@ -39,8 +39,8 @@ public class WorkflowSyncCronJob extends BaseCronJob { String catalogueCode = bb.getPropValue("PORTAL_INFO", "catalogueCode"); String workflowAuthTable = bb.getPropValue("PORTAL_INFO", "workflowAuthTable"); String timeNodeTable = bb.getPropValue("PORTAL_INFO", "timeNodeTable"); - String accountName = bb.getPropValue("PORTAL_INFO", "accountName"); - String password = bb.getPropValue("PORTAL_INFO", "password"); + String accountName = bb.getPropValue("PORTAL_INFO", "username"); + String password = bb.getPropValue("PORTAL_INFO", "passwd"); String timeNodeFormModeId = bb.getPropValue("PORTAL_INFO", "timeNodeFormModeId"); //全量同步使用全量同步方法 if (SYNC_ALL.equals(syncType)) { @@ -202,7 +202,7 @@ public class WorkflowSyncCronJob extends BaseCronJob { */ private void writeTimeNode(String timeNodeTable, String currentTime, String syncType, String timeNodeUse, String formmodeid) { RecordSet recordSet = new RecordSet(); - String sql = "insert into " + timeNodeTable + "(id,formmodeid,tblx,tbsj,zy) values(?,?,?,?,?)"; + String sql = "insert into " + timeNodeTable + "(id,formmodeid,type,timenode,useto) values(?,?,?,?,?)"; recordSet.executeUpdate(sql, UUID.randomUUID(), formmodeid, syncType, currentTime, timeNodeUse); } } diff --git a/src/weaver/interfaces/util/HttpUtils.java b/src/weaver/interfaces/util/HttpUtils.java index 3e3cee8a..3f99659d 100644 --- a/src/weaver/interfaces/util/HttpUtils.java +++ b/src/weaver/interfaces/util/HttpUtils.java @@ -7,6 +7,7 @@ import org.apache.commons.collections.MapUtils; import org.apache.commons.httpclient.HttpStatus; import org.apache.http.Header; import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; import org.apache.http.StatusLine; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; @@ -49,7 +50,7 @@ public class HttpUtils { } } - CloseableHttpResponse response = httpClient.execute(httpPost); + HttpResponse response = httpClient.execute(httpPost); String result; result = getString(response); @@ -66,24 +67,15 @@ public class HttpUtils { } } - private static String getString(CloseableHttpResponse response) throws IOException { - String result; - try { - StatusLine statusLine = response.getStatusLine(); - if (statusLine.getStatusCode() != HttpStatus.SC_OK) { - throw new RuntimeException("Unexpected failure: " + statusLine.toString()); - } - + private static String getString(HttpResponse response) throws IOException { + String result = null; + if (response != null) { HttpEntity resEntity = response.getEntity(); if (resEntity != null) { - result = EntityUtils.toString(resEntity, Charset.forName("UTF-8")); - EntityUtils.consume(resEntity); - } else { - result = null; + result = EntityUtils.toString(resEntity, "utf-8"); } - } finally { - response.close(); } + return result; }