工具类修改

feature-LeeD-20221025
李栋 3 years ago
parent 0153a31460
commit a7bd12fcd7

@ -39,8 +39,8 @@ public class WorkflowSyncCronJob extends BaseCronJob {
String catalogueCode = bb.getPropValue("PORTAL_INFO", "catalogueCode"); String catalogueCode = bb.getPropValue("PORTAL_INFO", "catalogueCode");
String workflowAuthTable = bb.getPropValue("PORTAL_INFO", "workflowAuthTable"); String workflowAuthTable = bb.getPropValue("PORTAL_INFO", "workflowAuthTable");
String timeNodeTable = bb.getPropValue("PORTAL_INFO", "timeNodeTable"); String timeNodeTable = bb.getPropValue("PORTAL_INFO", "timeNodeTable");
String accountName = bb.getPropValue("PORTAL_INFO", "accountName"); String accountName = bb.getPropValue("PORTAL_INFO", "username");
String password = bb.getPropValue("PORTAL_INFO", "password"); String password = bb.getPropValue("PORTAL_INFO", "passwd");
String timeNodeFormModeId = bb.getPropValue("PORTAL_INFO", "timeNodeFormModeId"); String timeNodeFormModeId = bb.getPropValue("PORTAL_INFO", "timeNodeFormModeId");
//全量同步使用全量同步方法 //全量同步使用全量同步方法
if (SYNC_ALL.equals(syncType)) { 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) { private void writeTimeNode(String timeNodeTable, String currentTime, String syncType, String timeNodeUse, String formmodeid) {
RecordSet recordSet = new RecordSet(); 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); recordSet.executeUpdate(sql, UUID.randomUUID(), formmodeid, syncType, currentTime, timeNodeUse);
} }
} }

@ -7,6 +7,7 @@ import org.apache.commons.collections.MapUtils;
import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.HttpStatus;
import org.apache.http.Header; import org.apache.http.Header;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine; import org.apache.http.StatusLine;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet; 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; String result;
result = getString(response); result = getString(response);
@ -66,24 +67,15 @@ public class HttpUtils {
} }
} }
private static String getString(CloseableHttpResponse response) throws IOException { private static String getString(HttpResponse response) throws IOException {
String result; String result = null;
try { if (response != null) {
StatusLine statusLine = response.getStatusLine();
if (statusLine.getStatusCode() != HttpStatus.SC_OK) {
throw new RuntimeException("Unexpected failure: " + statusLine.toString());
}
HttpEntity resEntity = response.getEntity(); HttpEntity resEntity = response.getEntity();
if (resEntity != null) { if (resEntity != null) {
result = EntityUtils.toString(resEntity, Charset.forName("UTF-8")); result = EntityUtils.toString(resEntity, "utf-8");
EntityUtils.consume(resEntity);
} else {
result = null;
} }
} finally {
response.close();
} }
return result; return result;
} }

Loading…
Cancel
Save