修改接口调用方式及关闭数据库连接
This commit is contained in:
parent
4922064aa6
commit
58794136d9
Binary file not shown.
@ -90,7 +90,8 @@ public class CreateWorkflowServiceJob implements IJob {
|
||||
// HttpURLConnection 发送SOAP请求
|
||||
System.out.println("HttpURLConnection 发送SOAP请求");
|
||||
|
||||
String postSoap = UtilUrl.doPostSoap("http://10.105.1.59:80/services/WorkflowService", xmlStr, "");
|
||||
UtilUrl uc=new UtilUrl();
|
||||
String postSoap = uc.doPostSoap("http://10.105.1.59:80/services/WorkflowService", xmlStr, "");
|
||||
|
||||
/*// HttpClient发送SOAP请求
|
||||
System.out.println("HttpClient 发送SOAP请求");
|
||||
|
||||
@ -889,8 +889,8 @@ public class SendReadBycontract implements IJob {
|
||||
"</soapenv:Envelope>";
|
||||
System.out.println("xmlStr>>>>>>>>"+xmlStr);
|
||||
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
|
||||
|
||||
String postSoap = UtilUrl.doPostSoap(readurl, xmlStr, "");
|
||||
UtilUrl uc=new UtilUrl();
|
||||
String postSoap = uc.doPostSoap(readurl, xmlStr, "");
|
||||
Document document = DocumentHelper.parseText(postSoap);
|
||||
Element rootElement = document.getRootElement();
|
||||
System.out.println("rootElement>>>>>>"+rootElement);
|
||||
|
||||
@ -608,7 +608,8 @@ public class TestSendOARead implements IJob {
|
||||
System.out.println("xmlStr>>>>>>>>"+xmlStr);
|
||||
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
|
||||
|
||||
String postSoap = UtilUrl.doPostSoap(readurl, xmlStr, "");
|
||||
UtilUrl uc=new UtilUrl();
|
||||
String postSoap = uc.doPostSoap(readurl, xmlStr, "");
|
||||
Document document = DocumentHelper.parseText(postSoap);
|
||||
Element rootElement = document.getRootElement();
|
||||
System.out.println("rootElement>>>>>>"+rootElement);
|
||||
|
||||
@ -901,7 +901,8 @@ public class sendReadByDataid {
|
||||
//System.out.println("xmlStr>>>>>>>>" + xmlStr);
|
||||
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
|
||||
|
||||
String postSoap = UtilUrl.doPostSoap(readurl, xmlStr, "");
|
||||
UtilUrl uc=new UtilUrl();
|
||||
String postSoap = uc.doPostSoap(readurl, xmlStr, "");
|
||||
Document document = DocumentHelper.parseText(postSoap);
|
||||
Element rootElement = document.getRootElement();
|
||||
//System.out.println("rootElement>>>>>>" + rootElement);
|
||||
|
||||
@ -897,7 +897,8 @@ public class sendReadByDataid2 {
|
||||
System.out.println("xmlStr>>>>>>>>" + xmlStr);
|
||||
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
|
||||
|
||||
String postSoap = UtilUrl.doPostSoap(readurl, xmlStr, "");
|
||||
UtilUrl uc=new UtilUrl();
|
||||
String postSoap = uc.doPostSoap(readurl, xmlStr, "");
|
||||
Document document = DocumentHelper.parseText(postSoap);
|
||||
Element rootElement = document.getRootElement();
|
||||
System.out.println("rootElement>>>>>>" + rootElement);
|
||||
|
||||
@ -699,7 +699,8 @@ public class sendReadByDataid3 {
|
||||
System.out.println("xmlStr>>>>>>>>" + xmlStr);
|
||||
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
|
||||
|
||||
String postSoap = UtilUrl.doPostSoap(readurl, xmlStr, "");
|
||||
UtilUrl uc=new UtilUrl();
|
||||
String postSoap = uc.doPostSoap(readurl, xmlStr, "");
|
||||
Document document = DocumentHelper.parseText(postSoap);
|
||||
Element rootElement = document.getRootElement();
|
||||
System.out.println("rootElement>>>>>>" + rootElement);
|
||||
|
||||
@ -26,6 +26,7 @@ import com.actionsoft.bpms.server.fs.DCContext;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.bpms.util.UUIDGener;
|
||||
import com.actionsoft.bpms.util.UtilString;
|
||||
import com.actionsoft.exception.AWSDataAccessException;
|
||||
import com.actionsoft.exception.AWSException;
|
||||
import com.actionsoft.exception.AWSQuotaException;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
@ -111,8 +112,10 @@ public class TaskController {
|
||||
* @param logType
|
||||
*/
|
||||
public void setUserLog(String processInstId, String userid, String logType) {
|
||||
Connection open = DBSql.open();
|
||||
System.err.println("用户登录记录存入日志========>" + userid + "_类型:" + logType);
|
||||
if (UtilString.isNotEmpty(userid)) {
|
||||
try {
|
||||
//待阅更新已读记录
|
||||
if ("3".equals(logType)) {
|
||||
String dateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
@ -124,7 +127,7 @@ public class TaskController {
|
||||
* +dateTime+"',READCOUNT = "+readCount+" WHERE PROCESSID = '"
|
||||
* +processInstId+"' AND USER_ID = '"+userid+"'"); }else { }
|
||||
*/
|
||||
DBSql.update("UPDATE BO_ACT_DATAID SET READSTATE = '已读',READTIMES = '" + dateTime + "',READCOUNT = 1 WHERE PROCESSID = '" + processInstId + "' AND USER_ID = '" + userid + "'");
|
||||
//DBSql.update(open,"UPDATE BO_ACT_DATAID SET READSTATE = '已读',READTIMES = '" + dateTime + "',READCOUNT = 1 WHERE PROCESSID = '" + processInstId + "' AND USER_ID = '" + userid + "'");
|
||||
|
||||
|
||||
//将已读数据插入至BO_ACT_ALREADY_DATAID ,并把BO_ACT_DATAID中此条已读数据删除
|
||||
@ -134,17 +137,34 @@ public class TaskController {
|
||||
DBSql.update(sql);*/
|
||||
|
||||
|
||||
String sqly = "SELECT PROCESSID,USER_ID,USERDEP,READTIMES,DATAID,TITLE,SENDTYPE,READSTATE,READCOUNT FROM BO_ACT_DATAID WHERE PROCESSID='" + processInstId + "' AND USER_ID='"+userid+"' ";
|
||||
RowMap mapsy = DBSql.getMap(sqly);
|
||||
String sqly = "SELECT PROCESSID,USER_ID,USERDEP,READTIMES,DATAID,TITLE,SENDTYPE,READSTATE,READCOUNT,ID FROM BO_ACT_DATAID WHERE PROCESSID='" + processInstId + "' AND USER_ID='"+userid+"' ";
|
||||
RowMap mapsy = DBSql.getMap(open,sqly);
|
||||
if (null != mapsy && !mapsy.isEmpty()) {
|
||||
String alsqly = "SELECT USER_ID FROM BO_ACT_ALREADY_DATAID WHERE PROCESSID='" + processInstId + "' AND USER_ID='"+userid+"' ";
|
||||
if(alsqly==null){
|
||||
RowMap alsqlyMap = DBSql.getMap(open,alsqly);
|
||||
if(alsqlyMap==null){
|
||||
String sql = "insert into BO_ACT_ALREADY_DATAID (ID,PROCESSID,USER_ID,READTIMES,DATAID,TITLE,READSTATE) values ('%s', '%s', '%s', '%s', '%s', '%s','%s')";
|
||||
String id = UUIDGener.getUUID();
|
||||
int update = DBSql.update(String.format(sql, id, mapsy.getString("PROCESSID"), mapsy.getString("USER_ID"), mapsy.get("READTIMES"), mapsy.getString("DATAID"),mapsy.getString("TITLE"),mapsy.getString("READSTATE")));
|
||||
int update = DBSql.update(open,String.format(sql, id, mapsy.getString("PROCESSID"), mapsy.getString("USER_ID"), dateTime, mapsy.getString("DATAID"),mapsy.getString("TITLE"),mapsy.getString("READSTATE")));
|
||||
|
||||
/* ProcessInstance boProcessInstance = SDK.getProcessAPI()
|
||||
.createBOProcessInstance("obj_1a2207bf57eb4ed982ed24b9ed80e260", "admin", "OA已阅日志");
|
||||
|
||||
BO bo=new BO();
|
||||
bo.set("PROCESSID",mapsy.getString("PROCESSID"));
|
||||
bo.set("USER_ID",mapsy.getString("USER_ID"));
|
||||
bo.set("READTIMES",mapsy.getString("READTIMES"));
|
||||
bo.set("DATAID",mapsy.getString("DATAID"));
|
||||
bo.set("TITLE",mapsy.getString("TITLE"));
|
||||
bo.set("READSTATE",mapsy.getString("READSTATE"));
|
||||
int count=SDK.getBOAPI().create("BO_ACT_ALREADY_DATAID", bo, boProcessInstance.getId(), boProcessInstance.getCreateUser());*/
|
||||
|
||||
if(update!=0){
|
||||
String sql1 = "DELETE FROM BO_ACT_DATAID WHERE READSTATE='已读' AND PROCESSID='"+processInstId+"'AND USER_ID='"+userid+"'";
|
||||
DBSql.update(sql1);
|
||||
System.out.println("count==========="+update);
|
||||
String sql1 = "DELETE FROM BO_ACT_DATAID WHERE PROCESSID='"+processInstId+"'AND USER_ID='"+userid+"'";
|
||||
DBSql.update(open,sql1);
|
||||
|
||||
//SDK.getBOAPI().remove("BO_ACT_DATAID",mapsy.getString("ID"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -164,6 +184,12 @@ public class TaskController {
|
||||
bo.set("LOGTYPE", Integer.valueOf(logType));
|
||||
SDK.getBOAPI().createDataBO("BO_EU_USER_LOGIN_LOG", bo, UserContext.fromUID("admin"));
|
||||
|
||||
DBSql.close(open);
|
||||
} catch (Exception e) {
|
||||
DBSql.close(open);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -242,6 +268,10 @@ public class TaskController {
|
||||
//pc端待阅
|
||||
@Mapping("com.yili_process_page")
|
||||
public String processTest(UserContext me, RequestParams params) throws IOException, SQLException {
|
||||
|
||||
long start_time = System.currentTimeMillis();
|
||||
System.out.println("com.yili_process_page开始时间>>>>>>>>>>>>"+start_time);
|
||||
|
||||
// System.out.println("params>>>>>>>>>>>>"+params.toString());
|
||||
// System.out.println("UserContext>>>>>>>>>>>>"+me.getUID());
|
||||
String userMobile = me.getDeviceType();
|
||||
@ -257,7 +287,7 @@ public class TaskController {
|
||||
ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processInstId);
|
||||
try {
|
||||
// 记录门户待阅
|
||||
setRecord(me.getUID(), processInstId, instanceById.getTitle());
|
||||
setRecord(me.getUID(), processInstId, instanceById.getTitle(),conn);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
@ -676,7 +706,8 @@ public class TaskController {
|
||||
HttpClient client = new HttpClient();
|
||||
int timeout = 10000;
|
||||
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
|
||||
String s = UtilUrl.doPostSoap(readurl, xmlStr, "");
|
||||
UtilUrl uc=new UtilUrl();
|
||||
String s = uc.doPostSoap(readurl, xmlStr, "");
|
||||
System.err.println(instanceById.getTitle() + "OA待阅PC端阅读返回=======>" + s);
|
||||
String nums = DBSql.getString(
|
||||
"select READNUM from BO_EU_PAL_READ_LOG where PROCESSID = '" + processInstId + "'");
|
||||
@ -705,7 +736,8 @@ public class TaskController {
|
||||
HttpClient client = new HttpClient();
|
||||
int timeout = 10000;
|
||||
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
|
||||
String s = UtilUrl.doPostSoap(readurl, xmlStr, "");
|
||||
UtilUrl uc=new UtilUrl();
|
||||
String s = uc.doPostSoap(readurl, xmlStr, "");
|
||||
System.err.println(instanceById.getTitle() + "OA待阅PC端阅读返回=======>" + s);
|
||||
String nums = DBSql.getString(
|
||||
"select READNUM from BO_EU_PAL_READ_LOG where PROCESSID = '" + processInstId + "'");
|
||||
@ -723,25 +755,29 @@ public class TaskController {
|
||||
// 用户打开阅览界面日志
|
||||
setUserLog(processInstId, me.getUID(), "3");
|
||||
|
||||
long have_time = System.currentTimeMillis();
|
||||
|
||||
System.out.println("com.yili_process_page耗时时间>>>>>>>>>>>>"+(have_time-start_time)/ 1000 + "秒");
|
||||
DBSql.close(conn);
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
conn.close();
|
||||
DBSql.close(conn);
|
||||
}
|
||||
return HtmlPageTemplate.merge("com.awspaas.user.apps.yili.integration", html, map);
|
||||
}
|
||||
|
||||
//门户待阅同步更新
|
||||
public String setRecord(String uid, String id, String fileName) {
|
||||
public String setRecord(String uid, String id, String fileName,Connection conn) {
|
||||
String sql = "SELECT READFILECOUNT FROM BO_EU_PAL_RECORD WHERE FILEID = ? AND READFILENAME = ?";
|
||||
RowMap map= DBSql.getMap(sql, new Object[]{id, uid});
|
||||
RowMap map= DBSql.getMap(conn,sql, new Object[]{id, uid});
|
||||
int num = 0;
|
||||
if (null != map) {
|
||||
String readCount = map.getString("READFILECOUNT");
|
||||
int count = Integer.parseInt(readCount) + 1;
|
||||
String s = "UPDATE BO_EU_PAL_RECORD SET READFILECOUNT = ? WHERE FILEID = ? AND READFILENAME = ?";
|
||||
num = DBSql.update(s, new Object[]{count, id, uid});
|
||||
num = DBSql.update(conn,s, new Object[]{count, id, uid});
|
||||
} else {
|
||||
BO bo = new BO();
|
||||
bo.set("FILEID", id);
|
||||
@ -758,6 +794,8 @@ public class TaskController {
|
||||
|
||||
@Mapping("com.yili_process_page_phone")
|
||||
public String processPhone(UserContext me, RequestParams params) throws SQLException {
|
||||
long start_time = System.currentTimeMillis();
|
||||
System.out.println("com.yili_process_page_phone开始时间>>>>>>>>>>>>"+start_time);
|
||||
ArrayList<String> isNumberAscArray = new ArrayList<String>();
|
||||
String userMobile = me.getDeviceType();
|
||||
Connection conn = DBSql.open();
|
||||
@ -773,7 +811,7 @@ public class TaskController {
|
||||
ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processInstId);
|
||||
try {
|
||||
//记录门户待阅
|
||||
setRecord(me.getUID(), processInstId, instanceById.getTitle());
|
||||
setRecord(me.getUID(), processInstId, instanceById.getTitle(),conn);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
@ -1375,7 +1413,8 @@ public class TaskController {
|
||||
+ " </web:service>" + " </soapenv:Body>" + "</soapenv:Envelope>";
|
||||
int timeout = 10000;
|
||||
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
|
||||
String s = UtilUrl.doPostSoap(readurl, xmlStr, "");
|
||||
UtilUrl uc=new UtilUrl();
|
||||
String s = uc.doPostSoap(readurl, xmlStr, "");
|
||||
//System.err.println(instanceById.getTitle()+"_OA待阅移动端阅读返回=======>"+s);
|
||||
String nums = DBSql.getString(
|
||||
"select READNUM from BO_EU_PAL_READ_LOG where PROCESSID = '" + processInstId + "'");
|
||||
@ -1402,7 +1441,8 @@ public class TaskController {
|
||||
+ " </web:service>" + " </soapenv:Body>" + "</soapenv:Envelope>";
|
||||
int timeout = 10000;
|
||||
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
|
||||
String s = UtilUrl.doPostSoap(readurl, xmlStr, "");
|
||||
UtilUrl uc=new UtilUrl();
|
||||
String s = uc.doPostSoap(readurl, xmlStr, "");
|
||||
System.err.println(instanceById.getTitle() + "_OA待阅移动端阅读返回=======>" + s);
|
||||
String nums = DBSql.getString(
|
||||
"select READNUM from BO_EU_PAL_READ_LOG where PROCESSID = '" + processInstId + "'");
|
||||
@ -1463,11 +1503,18 @@ public class TaskController {
|
||||
* DBSql.update("update BO_EU_PAL_READ_LOG set READNUM = '" + read_num +
|
||||
* "' where PROCESSID = '" + processInstId + "'"); }
|
||||
*/
|
||||
DBSql.close(conn);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
conn.close();
|
||||
DBSql.close(conn);
|
||||
}
|
||||
|
||||
long have_time = System.currentTimeMillis();
|
||||
|
||||
System.out.println("com.yili_process_page_phone耗时时间>>>>>>>>>>>>"+(have_time-start_time)/ 1000 + "秒");
|
||||
|
||||
|
||||
return HtmlPageTemplate.merge("com.awspaas.user.apps.yili.integration", html, map);
|
||||
}
|
||||
|
||||
|
||||
@ -57,7 +57,8 @@ public class HttpClientUtils {
|
||||
"</soapenv:Envelope>";
|
||||
|
||||
System.out.println("xmlstr================"+xmlStr);
|
||||
String postSoap = UtilUrl.doPostSoap(url, xmlStr, "");
|
||||
UtilUrl uc=new UtilUrl();
|
||||
String postSoap = uc.doPostSoap(url, xmlStr, "");
|
||||
|
||||
return postSoap;
|
||||
}
|
||||
@ -77,7 +78,8 @@ public class HttpClientUtils {
|
||||
"</soapenv:Envelope>";
|
||||
|
||||
System.out.println("xmlstr================"+xmlStr);
|
||||
String postSoap = UtilUrl.doPostSoap(url, xmlStr, "");
|
||||
UtilUrl uc=new UtilUrl();
|
||||
String postSoap = uc.doPostSoap(url, xmlStr, "");
|
||||
|
||||
return postSoap;
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ import java.nio.charset.Charset;
|
||||
public class UtilUrl {
|
||||
|
||||
//使用SOAP1.1发送消息
|
||||
public static String doPostSoap(String postUrl, String soapXml, String soapAction) {
|
||||
public String doPostSoap(String postUrl, String soapXml, String soapAction) {
|
||||
String retStr = "";
|
||||
// 创建HttpClientBuilder
|
||||
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user