更新已阅数据
This commit is contained in:
parent
85f8cee2ce
commit
4a3066f09a
Binary file not shown.
@ -1,33 +1,14 @@
|
||||
package com.awspaas.user.apps.integration.oauth;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.OutputAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.constant.OutputConst;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.dao.OutputTask;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppProfile;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.web.UpfileWeb;
|
||||
import com.actionsoft.apps.coe.pal.util.HighSecurityUtil;
|
||||
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.HistoryTaskInstance;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance;
|
||||
import com.actionsoft.bpms.client.form.UserTaskFormsWeb;
|
||||
@ -43,31 +24,36 @@ import com.actionsoft.bpms.server.bind.annotation.Controller;
|
||||
import com.actionsoft.bpms.server.bind.annotation.Mapping;
|
||||
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.AWSException;
|
||||
import com.actionsoft.exception.AWSQuotaException;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.AppAPI;
|
||||
import com.actionsoft.sdk.local.api.ORGAPI;
|
||||
import com.actionsoft.sdk.local.api.TaskAPI;
|
||||
import com.actionsoft.sdk.local.api.*;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.awspaas.user.apps.integration.event.OutputDCFileProcessor;
|
||||
import com.awspaas.user.apps.integration.util.HttpClientUtils;
|
||||
import com.awspaas.user.apps.integration.util.UtilUrl;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.methods.PostMethod;
|
||||
import org.apache.commons.httpclient.methods.RequestEntity;
|
||||
import org.apache.commons.httpclient.methods.StringRequestEntity;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
@Controller
|
||||
public class TaskController {
|
||||
|
||||
/**
|
||||
* OA系统单点访问PAL系统
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Mapping("com.yili_pal_portal_open")
|
||||
@ -79,21 +65,21 @@ public class TaskController {
|
||||
|
||||
App app = new App();
|
||||
String tokens = app.getTokens("http://10.114.11.135:8088/portal/yili.html", code);
|
||||
if(StringUtils.isEmpty(tokens)){
|
||||
if (StringUtils.isEmpty(tokens)) {
|
||||
//System.out.println("这个认证是失败的,code为空,请联系管理员");;
|
||||
}else {
|
||||
} else {
|
||||
JSONObject jsonObjects = JSONObject.parseObject(tokens);
|
||||
String access_token = jsonObjects.getString("access_token");
|
||||
String userInfo = app.getUserInfo(access_token);
|
||||
|
||||
if (StringUtils.isNotEmpty(userInfo)){
|
||||
if (StringUtils.isNotEmpty(userInfo)) {
|
||||
JSONObject json = JSONObject.parseObject(userInfo);
|
||||
//System.out.println("json-=====>>>>"+json);
|
||||
if (StringUtils.isNotEmpty(json.getString("employeenumber"))){
|
||||
if (StringUtils.isNotEmpty(json.getString("employeenumber"))) {
|
||||
//System.out.println("userid》》》》》》》》》》"+json.getString("employeenumber"));
|
||||
userid = json.getString("employeenumber");
|
||||
try {
|
||||
setUserLog("",userid,"1");
|
||||
setUserLog("", userid, "1");
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
@ -105,10 +91,10 @@ public class TaskController {
|
||||
String sessionId = UserContext.fromUID(userid).getSessionId();
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
|
||||
String url = portalUrl +"/r/w?sid="+sessionId+"&cmd=com.actionsoft.apps.skins.mportal3_home_page&id=5af46cd5-a1bc-4125-a144-86d1a199eec1";
|
||||
String url = portalUrl + "/r/w?sid=" + sessionId + "&cmd=com.actionsoft.apps.skins.mportal3_home_page&id=5af46cd5-a1bc-4125-a144-86d1a199eec1";
|
||||
// String palPortalUrl= portalUrl + "/r/w?sid="+sessionId+"&cmd=com.actionsoft.apps.skins.mportal3_home_page&id=5af46cd5-a1bc-4125-a144-86d1a199eec1";
|
||||
|
||||
String portal_url = "https://bpm.yili.com:8088"+"/portal/r/or?cmd=com.actionsoft.apps.skins.mportal3_home_page&id=5af46cd5-a1bc-4125-a144-86d1a199eec1&sid="+sessionId+"&oauthName=oauthLogin&code="+code;
|
||||
String portal_url = "https://bpm.yili.com:8088" + "/portal/r/or?cmd=com.actionsoft.apps.skins.mportal3_home_page&id=5af46cd5-a1bc-4125-a144-86d1a199eec1&sid=" + sessionId + "&oauthName=oauthLogin&code=" + code;
|
||||
|
||||
//ro.put("new_url",url);
|
||||
|
||||
@ -117,17 +103,17 @@ public class TaskController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 用户登录日志
|
||||
*
|
||||
* @param userid
|
||||
* @param logType
|
||||
*/
|
||||
public void setUserLog(String processInstId,String userid,String logType) {
|
||||
System.err.println("用户登录记录存入日志========>"+userid+"_类型:"+logType);
|
||||
public void setUserLog(String processInstId, String userid, String logType) {
|
||||
System.err.println("用户登录记录存入日志========>" + userid + "_类型:" + logType);
|
||||
if (UtilString.isNotEmpty(userid)) {
|
||||
//待阅更新已读记录
|
||||
if("3".equals(logType)) {
|
||||
if ("3".equals(logType)) {
|
||||
String dateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
/*
|
||||
* RowMap map = DBSql.getMap("SELECT * FROM BO_ACT_DATAID WHERE PROCESSID = '"
|
||||
@ -137,22 +123,31 @@ 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("UPDATE BO_ACT_DATAID SET READSTATE = '已读',READTIMES = '" + dateTime + "',READCOUNT = 1 WHERE PROCESSID = '" + processInstId + "' AND USER_ID = '" + userid + "'");
|
||||
|
||||
|
||||
//将已读数据插入至BO_ACT_ALREADY_DATAID ,并把BO_ACT_DATAID中此条已读数据删除
|
||||
|
||||
String sql = "INSERT INTO BO_ACT_ALREADY_DATAID (\"ID\",ORGID,BINDID,CREATEDATE,CREATEUSER,UPDATEDATE,UPDATEUSER,PROCESSDEFID,ISEND,PROCESSID,USER_ID,USERDEP,READTIMES,DATAID,\"RESULT\",TITLE,SENDTYPE,READSTATE,READCOUNT,\"TYPE\")\n" +
|
||||
/*String sql = "INSERT INTO BO_ACT_ALREADY_DATAID (\"ID\",ORGID,BINDID,CREATEDATE,CREATEUSER,UPDATEDATE,UPDATEUSER,PROCESSDEFID,ISEND,PROCESSID,USER_ID,USERDEP,READTIMES,DATAID,\"RESULT\",TITLE,SENDTYPE,READSTATE,READCOUNT,\"TYPE\")\n" +
|
||||
"\t\t\t\tSELECT \"ID\",ORGID,BINDID,CREATEDATE,CREATEUSER,UPDATEDATE,UPDATEUSER,PROCESSDEFID,ISEND,PROCESSID,USER_ID,USERDEP,READTIMES,DATAID,\"RESULT\",TITLE,SENDTYPE,READSTATE,READCOUNT,\"TYPE\"\n" +
|
||||
"\t\t\t\tFROM BO_ACT_DATAID WHERE READSTATE='已读' AND PROCESSID = '"+processInstId+"' AND USER_ID = '"+userid+"'";
|
||||
DBSql.update(sql);
|
||||
"\t\t\t\tFROM BO_ACT_DATAID WHERE READSTATE='已读' AND PROCESSID = '" + processInstId + "' AND USER_ID = '" + userid + "'";
|
||||
DBSql.update(sql);*/
|
||||
|
||||
String sql1 = "DELETE FROM BO_ACT_DATAID WHERE READSTATE='已读' AND PROCESSID = '"+processInstId+"' AND USER_ID = '"+userid+"'";
|
||||
|
||||
|
||||
// 示例代码
|
||||
BOQueryAPI query = SDK.getBOAPI().query("BO_ACT_DATAID").addQuery("PROCESSID=", processInstId).addQuery("USER_ID=",userid);
|
||||
// 指定将要复制到新的bo表以及流程实例ID
|
||||
BOCopyAPI copyAPI = query.copyTo("BO_ACT_ALREADY_DATAID", processInstId);
|
||||
// 如果新表需要新的值,请添加新数据
|
||||
copyAPI.addNewData("USER", "");
|
||||
// 执行复制操作
|
||||
copyAPI.exec();
|
||||
|
||||
|
||||
String sql1 = "DELETE FROM BO_ACT_DATAID WHERE READSTATE='已读' AND PROCESSID = '" + processInstId + "' AND USER_ID = '" + userid + "'";
|
||||
DBSql.update(sql1);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
String logTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
||||
BO bo = new BO();
|
||||
@ -160,8 +155,8 @@ public class TaskController {
|
||||
UserModel user = orgapi.getUser(userid);
|
||||
DepartmentModel departmentByUser = orgapi.getDepartmentByUser(userid);
|
||||
bo.set("LOGINUSERNAME", userid);
|
||||
bo.set("USERBUNAME",user.getExt4());
|
||||
bo.set("USERPOST",user.getPositionName());
|
||||
bo.set("USERBUNAME", user.getExt4());
|
||||
bo.set("USERPOST", user.getPositionName());
|
||||
bo.set("USERDEPTNAME", departmentByUser.getPathNameOfCache());
|
||||
bo.set("LOGINTIME", logTime);
|
||||
bo.set("LOGINCOUNTS", 1);
|
||||
@ -174,6 +169,7 @@ public class TaskController {
|
||||
|
||||
/**
|
||||
* OA系统单点访问表单数据
|
||||
*
|
||||
* @param me
|
||||
* @param params
|
||||
* @return
|
||||
@ -184,14 +180,14 @@ public class TaskController {
|
||||
//System.out.println("参数输出==========="+params.asMap());
|
||||
//打开待办时记录日志
|
||||
try {
|
||||
setUserLog("",me.getUID(),"2");
|
||||
setUserLog("", me.getUID(), "2");
|
||||
} catch (Exception e) {
|
||||
}
|
||||
String sessionId = me.getSessionId();
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
if(!SDK.getPortalAPI().checkSession(sessionId)) {
|
||||
if (!SDK.getPortalAPI().checkSession(sessionId)) {
|
||||
SSOUtil ssoUtil = new SSOUtil();
|
||||
sessionId = ssoUtil.registerClientSessionNoPassword(me.getUID(), "cn",portalUrl, me.getDeviceType());
|
||||
sessionId = ssoUtil.registerClientSessionNoPassword(me.getUID(), "cn", portalUrl, me.getDeviceType());
|
||||
}
|
||||
UserContext uc = UserContext.fromSessionId(sessionId);
|
||||
UserTaskFormsWeb web = new UserTaskFormsWeb(uc);
|
||||
@ -204,15 +200,15 @@ public class TaskController {
|
||||
}
|
||||
int openState = 0;
|
||||
//根据流程实例去获取表单的 状态
|
||||
if (!taskInstId.equals("")){
|
||||
if (!taskInstId.equals("")) {
|
||||
TaskAPI taskAPI = SDK.getTaskAPI();
|
||||
final TaskInstance taskInstance = taskAPI.getTaskInstance(taskInstId);
|
||||
if (null == taskInstance){
|
||||
taskInstId="";
|
||||
}else{
|
||||
if ("delete".equals(taskInstance.getControlState())){
|
||||
taskInstId="";
|
||||
}else{
|
||||
if (null == taskInstance) {
|
||||
taskInstId = "";
|
||||
} else {
|
||||
if ("delete".equals(taskInstance.getControlState())) {
|
||||
taskInstId = "";
|
||||
} else {
|
||||
openState = taskInstance.getState();
|
||||
}
|
||||
}
|
||||
@ -261,8 +257,7 @@ public class TaskController {
|
||||
try {
|
||||
// 记录门户待阅
|
||||
setRecord(me.getUID(), processInstId, instanceById.getTitle());
|
||||
// 用户打开阅览界面日志
|
||||
setUserLog(processInstId, me.getUID(), "3");
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
@ -290,7 +285,7 @@ public class TaskController {
|
||||
RowMap Row_maps_is_not_publish = DBSql.getMap(conn, is_not_publish_sql);
|
||||
String id = bo.getString("TASKID");
|
||||
jsonObject.put("title", bo.get("PUBLISHFILENAME"));
|
||||
jsonObject.put("file_number",0);
|
||||
jsonObject.put("file_number", 0);
|
||||
jsonObject.put("link",
|
||||
SDK.getPortalAPI().getPortalUrl()
|
||||
+ "/r/w?cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open&uuid="
|
||||
@ -356,28 +351,28 @@ public class TaskController {
|
||||
params_previews);
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
//按照附件编号排序
|
||||
String fileNamel= row.getString("FILENAME");
|
||||
if(UtilString.isNotEmpty(fileNamel)&&fileNamel.contains("附件")&&fileNamel.length()>2&&(fileNamel.contains(":")||fileNamel.contains(":"))) {
|
||||
if(fileNamel.indexOf("附件")==0) {
|
||||
String fileNamel = row.getString("FILENAME");
|
||||
if (UtilString.isNotEmpty(fileNamel) && fileNamel.contains("附件") && fileNamel.length() > 2 && (fileNamel.contains(":") || fileNamel.contains(":"))) {
|
||||
if (fileNamel.indexOf("附件") == 0) {
|
||||
int indexOf2 = 3;
|
||||
if(fileNamel.contains(":")) {
|
||||
if (fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}else if(fileNamel.contains(":")) {
|
||||
} else if (fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}
|
||||
String numberStr = fileNamel.substring(2,indexOf2);
|
||||
if(isNumeric(numberStr)&&!"".equals(numberStr)) {
|
||||
String numberStr = fileNamel.substring(2, indexOf2);
|
||||
if (isNumeric(numberStr) && !"".equals(numberStr)) {
|
||||
isNumberAscArray.add("true");
|
||||
int fileNumber = Integer.parseInt(numberStr);
|
||||
jsonObject1.put("file_number", fileNumber);
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
jsonObject1.put("title", row.getString("FILENAME"));
|
||||
@ -410,7 +405,7 @@ public class TaskController {
|
||||
RowMap Row_maps_is_not_publish = DBSql.getMap(conn, is_not_publish_sql);
|
||||
String id = bo.getString("TASKID");
|
||||
jsonObject.put("title", bo.get("STOPFILENAME"));
|
||||
jsonObject.put("file_number",0);
|
||||
jsonObject.put("file_number", 0);
|
||||
jsonObject.put("link",
|
||||
SDK.getPortalAPI().getPortalUrl()
|
||||
+ "/r/w?cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open&uuid="
|
||||
@ -476,28 +471,28 @@ public class TaskController {
|
||||
params_previews);
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
//按照附件编号排序
|
||||
String fileNamel= row.getString("FILENAME");
|
||||
if(UtilString.isNotEmpty(fileNamel)&&fileNamel.contains("附件")&&fileNamel.length()>2&&(fileNamel.contains(":")||fileNamel.contains(":"))) {
|
||||
if(fileNamel.indexOf("附件")==0) {
|
||||
String fileNamel = row.getString("FILENAME");
|
||||
if (UtilString.isNotEmpty(fileNamel) && fileNamel.contains("附件") && fileNamel.length() > 2 && (fileNamel.contains(":") || fileNamel.contains(":"))) {
|
||||
if (fileNamel.indexOf("附件") == 0) {
|
||||
int indexOf2 = 3;
|
||||
if(fileNamel.contains(":")) {
|
||||
if (fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}else if(fileNamel.contains(":")) {
|
||||
} else if (fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}
|
||||
String numberStr = fileNamel.substring(2,indexOf2);
|
||||
if(isNumeric(numberStr)&&!"".equals(numberStr)) {
|
||||
String numberStr = fileNamel.substring(2, indexOf2);
|
||||
if (isNumeric(numberStr) && !"".equals(numberStr)) {
|
||||
isNumberAscArray.add("true");
|
||||
int fileNumber = Integer.parseInt(numberStr);
|
||||
jsonObject1.put("file_number", fileNumber);
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
jsonObject1.put("title", row.getString("FILENAME"));
|
||||
@ -528,7 +523,7 @@ public class TaskController {
|
||||
RowMap Row_maps_is_not_publish = DBSql.getMap(conn, is_not_publish_sql);
|
||||
String id = bo.getString("TASKID");
|
||||
jsonObject.put("title", bo.get("CHANGEDFILENAMENEW"));
|
||||
jsonObject.put("file_number",0);
|
||||
jsonObject.put("file_number", 0);
|
||||
jsonObject.put("link",
|
||||
SDK.getPortalAPI().getPortalUrl()
|
||||
+ "/r/w?cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open&uuid="
|
||||
@ -593,28 +588,28 @@ public class TaskController {
|
||||
params_previews);
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
//按照附件编号排序
|
||||
String fileNamel= row.getString("FILENAME");
|
||||
if(UtilString.isNotEmpty(fileNamel)&&fileNamel.contains("附件")&&fileNamel.length()>2&&(fileNamel.contains(":")||fileNamel.contains(":"))) {
|
||||
if(fileNamel.indexOf("附件")==0) {
|
||||
String fileNamel = row.getString("FILENAME");
|
||||
if (UtilString.isNotEmpty(fileNamel) && fileNamel.contains("附件") && fileNamel.length() > 2 && (fileNamel.contains(":") || fileNamel.contains(":"))) {
|
||||
if (fileNamel.indexOf("附件") == 0) {
|
||||
int indexOf2 = 3;
|
||||
if(fileNamel.contains(":")) {
|
||||
if (fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}else if(fileNamel.contains(":")) {
|
||||
} else if (fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}
|
||||
String numberStr = fileNamel.substring(2,indexOf2);
|
||||
if(isNumeric(numberStr)&&!"".equals(numberStr)) {
|
||||
String numberStr = fileNamel.substring(2, indexOf2);
|
||||
if (isNumeric(numberStr) && !"".equals(numberStr)) {
|
||||
isNumberAscArray.add("true");
|
||||
int fileNumber = Integer.parseInt(numberStr);
|
||||
jsonObject1.put("file_number", fileNumber);
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
jsonObject1.put("title", row.getString("FILENAME"));
|
||||
@ -646,7 +641,7 @@ public class TaskController {
|
||||
map.put("sid", sid);
|
||||
// System.out.println("jsonArray=====>>>>>>>>>"+jsonArray);
|
||||
boolean contains = isNumberAscArray.contains("false");
|
||||
if(!contains) {
|
||||
if (!contains) {
|
||||
try {
|
||||
jsonArray.sort(Comparator.comparing(obj -> ((JSONObject) obj).getInteger("file_number")));
|
||||
} catch (Exception e) {
|
||||
@ -667,6 +662,7 @@ public class TaskController {
|
||||
List<BO> bo_act_dataid = SDK.getBOAPI().query("BO_ACT_DATAID").addQuery("PROCESSID=", processInstId)
|
||||
.addQuery("USER_ID=", usercode).list();
|
||||
if (bo_act_dataid.size() > 0) {
|
||||
System.out.println("查询未读数据=============" + processInstId + "USER_ID=========" + usercode);
|
||||
for (BO bo : bo_act_dataid) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("action", "read");
|
||||
@ -680,7 +676,36 @@ public class TaskController {
|
||||
int timeout = 10000;
|
||||
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
|
||||
String s = UtilUrl.doPostSoap(readurl, xmlStr, "");
|
||||
// System.err.println(instanceById.getTitle()+"OA待阅PC端阅读返回=======>"+s);
|
||||
System.err.println(instanceById.getTitle() + "OA待阅PC端阅读返回=======>" + s);
|
||||
String nums = DBSql.getString(
|
||||
"select READNUM from BO_EU_PAL_READ_LOG where PROCESSID = '" + processInstId + "'");
|
||||
if (UtilString.isNotEmpty(nums)) {
|
||||
Integer read_num = Integer.valueOf(nums);
|
||||
read_num += 1;
|
||||
DBSql.update("update BO_EU_PAL_READ_LOG set READNUM = '" + read_num + "' where PROCESSID = '"
|
||||
+ processInstId + "'");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
List<BO> actAlreadyDataid = SDK.getBOAPI().query("BO_ACT_ALREADY_DATAID").addQuery("PROCESSID=", processInstId)
|
||||
.addQuery("USER_ID=", usercode).list();
|
||||
if (actAlreadyDataid.size() > 0) {
|
||||
System.out.println("查询已读数据=============" + processInstId + "USER_ID=========" + usercode);
|
||||
for (BO bo : actAlreadyDataid) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("action", "read");
|
||||
jsonObject.put("status", "1");
|
||||
jsonObject.put("dataid", bo.getString("DATAID"));
|
||||
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n"
|
||||
+ " <soapenv:Header/>" + " <soapenv:Body>" + " <web:service>"
|
||||
+ " <web:in0>" + "<![CDATA[" + jsonObject + "]]>" + " </web:in0>"
|
||||
+ " </web:service>" + " </soapenv:Body>" + "</soapenv:Envelope>";
|
||||
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, "");
|
||||
System.err.println(instanceById.getTitle() + "OA待阅PC端阅读返回=======>" + s);
|
||||
String nums = DBSql.getString(
|
||||
"select READNUM from BO_EU_PAL_READ_LOG where PROCESSID = '" + processInstId + "'");
|
||||
if (UtilString.isNotEmpty(nums)) {
|
||||
@ -692,6 +717,11 @@ public class TaskController {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 用户打开阅览界面日志
|
||||
setUserLog(processInstId, me.getUID(), "3");
|
||||
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -702,15 +732,15 @@ public class TaskController {
|
||||
}
|
||||
|
||||
//门户待阅同步更新
|
||||
public String setRecord(String uid, String id,String fileName) {
|
||||
public String setRecord(String uid, String id, String fileName) {
|
||||
String sql = "SELECT * FROM BO_EU_PAL_RECORD WHERE FILEID = ? AND READFILENAME = ?";
|
||||
RowMap map = DBSql.getMap(sql, new Object[] { id, uid });
|
||||
RowMap map = DBSql.getMap(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(s, new Object[]{count, id, uid});
|
||||
} else {
|
||||
BO bo = new BO();
|
||||
bo.set("FILEID", id);
|
||||
@ -742,9 +772,8 @@ public class TaskController {
|
||||
ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processInstId);
|
||||
try {
|
||||
//记录门户待阅
|
||||
setRecord(me.getUID(), processInstId,instanceById.getTitle());
|
||||
// 用户打开阅览界面日志
|
||||
setUserLog(processInstId, me.getUID(), "3");
|
||||
setRecord(me.getUID(), processInstId, instanceById.getTitle());
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
@ -842,7 +871,7 @@ public class TaskController {
|
||||
|
||||
JSONObject jsonObjects = new JSONObject();
|
||||
jsonObjects.put("title", bo.get("PUBLISHFILENAME"));
|
||||
jsonObjects.put("file_number",0);
|
||||
jsonObjects.put("file_number", 0);
|
||||
jsonObjects.put("link",
|
||||
"https://bpm.yili.com:8088/portal/r" + ro.get("url").toString().substring(1));
|
||||
// jsonObjects.put("size","12k");
|
||||
@ -904,28 +933,28 @@ public class TaskController {
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
|
||||
//按照附件编号排序
|
||||
String fileNamel= row.getString("FILENAME");
|
||||
if(UtilString.isNotEmpty(fileNamel)&&fileNamel.contains("附件")&&fileNamel.length()>2&&(fileNamel.contains(":")||fileNamel.contains(":"))) {
|
||||
if(fileNamel.indexOf("附件")==0) {
|
||||
String fileNamel = row.getString("FILENAME");
|
||||
if (UtilString.isNotEmpty(fileNamel) && fileNamel.contains("附件") && fileNamel.length() > 2 && (fileNamel.contains(":") || fileNamel.contains(":"))) {
|
||||
if (fileNamel.indexOf("附件") == 0) {
|
||||
int indexOf2 = 3;
|
||||
if(fileNamel.contains(":")) {
|
||||
if (fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}else if(fileNamel.contains(":")) {
|
||||
} else if (fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}
|
||||
String numberStr = fileNamel.substring(2,indexOf2);
|
||||
if(isNumeric(numberStr)&&!"".equals(numberStr)) {
|
||||
String numberStr = fileNamel.substring(2, indexOf2);
|
||||
if (isNumeric(numberStr) && !"".equals(numberStr)) {
|
||||
isNumberAscArray.add("true");
|
||||
int fileNumber = Integer.parseInt(numberStr);
|
||||
jsonObject1.put("file_number", fileNumber);
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
jsonObject1.put("title", row.getString("FILENAME"));
|
||||
@ -1022,7 +1051,7 @@ public class TaskController {
|
||||
|
||||
JSONObject jsonObjects = new JSONObject();
|
||||
jsonObjects.put("title", bo.get("STOPFILENAME"));
|
||||
jsonObjects.put("file_number",0);
|
||||
jsonObjects.put("file_number", 0);
|
||||
jsonObjects.put("link",
|
||||
"https://bpm.yili.com:8088/portal/r" + ro.get("url").toString().substring(1));
|
||||
// jsonObjects.put("size","12k");
|
||||
@ -1089,28 +1118,28 @@ public class TaskController {
|
||||
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
//按照附件编号排序
|
||||
String fileNamel= row.getString("FILENAME");
|
||||
if(UtilString.isNotEmpty(fileNamel)&&fileNamel.contains("附件")&&fileNamel.length()>2&&(fileNamel.contains(":")||fileNamel.contains(":"))) {
|
||||
if(fileNamel.indexOf("附件")==0) {
|
||||
String fileNamel = row.getString("FILENAME");
|
||||
if (UtilString.isNotEmpty(fileNamel) && fileNamel.contains("附件") && fileNamel.length() > 2 && (fileNamel.contains(":") || fileNamel.contains(":"))) {
|
||||
if (fileNamel.indexOf("附件") == 0) {
|
||||
int indexOf2 = 3;
|
||||
if(fileNamel.contains(":")) {
|
||||
if (fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}else if(fileNamel.contains(":")) {
|
||||
} else if (fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}
|
||||
String numberStr = fileNamel.substring(2,indexOf2);
|
||||
if(isNumeric(numberStr)&&!"".equals(numberStr)) {
|
||||
String numberStr = fileNamel.substring(2, indexOf2);
|
||||
if (isNumeric(numberStr) && !"".equals(numberStr)) {
|
||||
isNumberAscArray.add("true");
|
||||
int fileNumber = Integer.parseInt(numberStr);
|
||||
jsonObject1.put("file_number", fileNumber);
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
jsonObject1.put("title", row.getString("FILENAME"));
|
||||
@ -1204,7 +1233,7 @@ public class TaskController {
|
||||
|
||||
JSONObject jsonObjects = new JSONObject();
|
||||
jsonObjects.put("title", bo.get("CHANGEDFILENAMENEW"));
|
||||
jsonObjects.put("file_number",0);
|
||||
jsonObjects.put("file_number", 0);
|
||||
jsonObjects.put("link",
|
||||
"https://bpm.yili.com:8088/portal/r" + ro.get("url").toString().substring(1));
|
||||
// jsonObjects.put("size","12k");
|
||||
@ -1264,28 +1293,28 @@ public class TaskController {
|
||||
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
//按照附件编号排序
|
||||
String fileNamel= row.getString("FILENAME");
|
||||
if(UtilString.isNotEmpty(fileNamel)&&fileNamel.contains("附件")&&fileNamel.length()>2&&(fileNamel.contains(":")||fileNamel.contains(":"))) {
|
||||
if(fileNamel.indexOf("附件")==0) {
|
||||
String fileNamel = row.getString("FILENAME");
|
||||
if (UtilString.isNotEmpty(fileNamel) && fileNamel.contains("附件") && fileNamel.length() > 2 && (fileNamel.contains(":") || fileNamel.contains(":"))) {
|
||||
if (fileNamel.indexOf("附件") == 0) {
|
||||
int indexOf2 = 3;
|
||||
if(fileNamel.contains(":")) {
|
||||
if (fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}else if(fileNamel.contains(":")) {
|
||||
} else if (fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}
|
||||
String numberStr = fileNamel.substring(2,indexOf2);
|
||||
if(isNumeric(numberStr)&&!"".equals(numberStr)) {
|
||||
String numberStr = fileNamel.substring(2, indexOf2);
|
||||
if (isNumeric(numberStr) && !"".equals(numberStr)) {
|
||||
isNumberAscArray.add("true");
|
||||
int fileNumber = Integer.parseInt(numberStr);
|
||||
jsonObject1.put("file_number", fileNumber);
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
|
||||
}else {
|
||||
} else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
jsonObject1.put("title", row.getString("FILENAME"));
|
||||
@ -1312,7 +1341,7 @@ public class TaskController {
|
||||
map.put("processInstId", processInstId);
|
||||
map.put("sid", sid);
|
||||
boolean contains = isNumberAscArray.contains("false");
|
||||
if(!contains) {
|
||||
if (!contains) {
|
||||
try {
|
||||
jsonArray.sort(Comparator.comparing(obj -> ((JSONObject) obj).getInteger("file_number")));
|
||||
} catch (Exception e) {
|
||||
@ -1356,8 +1385,37 @@ public class TaskController {
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
List<BO> alreadyDataid = SDK.getBOAPI().query("BO_ACT_ALREADY_DATAID").addQuery("PROCESSID=", processInstId)
|
||||
.addQuery("USER_ID=", usercode).list();
|
||||
if (alreadyDataid.size() > 0) {
|
||||
for (BO bo : alreadyDataid) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("status", "1");
|
||||
jsonObject.put("action", "read");
|
||||
jsonObject.put("dataid", bo.getString("DATAID"));
|
||||
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n"
|
||||
+ " <soapenv:Header/>" + " <soapenv:Body>" + " <web:service>"
|
||||
+ " <web:in0>" + "<![CDATA[" + jsonObject + "]]>" + " </web:in0>"
|
||||
+ " </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, "");
|
||||
System.err.println(instanceById.getTitle() + "_OA待阅移动端阅读返回=======>" + s);
|
||||
String nums = DBSql.getString(
|
||||
"select READNUM from BO_EU_PAL_READ_LOG where PROCESSID = '" + processInstId + "'");
|
||||
if (UtilString.isNotEmpty(nums)) {
|
||||
Integer read_num = Integer.valueOf(nums);
|
||||
read_num += 1;
|
||||
DBSql.update("update BO_EU_PAL_READ_LOG set READNUM = '" + read_num + "' where PROCESSID = '"
|
||||
+ processInstId + "'");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// 用户打开阅览界面日志
|
||||
setUserLog(processInstId, me.getUID(), "3");
|
||||
/*
|
||||
* JSONObject jsonObject = new JSONObject(); SimpleDateFormat sdf = new
|
||||
* SimpleDateFormat("yyyy-MM-dd"); String sql =
|
||||
@ -1412,14 +1470,15 @@ public class TaskController {
|
||||
|
||||
/**
|
||||
* 从 String 中提取数字
|
||||
*
|
||||
* @param string
|
||||
* @return
|
||||
*/
|
||||
public static String getNumberFromString(String string){
|
||||
public static String getNumberFromString(String string) {
|
||||
String str = string;
|
||||
str = str.trim();
|
||||
StringBuffer str2 = new StringBuffer();
|
||||
if(str != null && !"".equals(str)) {
|
||||
if (str != null && !"".equals(str)) {
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
if (str.charAt(i) >= 48 && str.charAt(i) <= 57) {
|
||||
String s = String.valueOf(str.charAt(i));
|
||||
@ -1431,7 +1490,7 @@ public class TaskController {
|
||||
}
|
||||
|
||||
public static boolean isNumeric(String str) {
|
||||
for (int i = str.length(); --i >= 0;) {
|
||||
for (int i = str.length(); --i >= 0; ) {
|
||||
int chr = str.charAt(i);
|
||||
if (chr < 48 || chr > 57)
|
||||
return false;
|
||||
@ -1440,5 +1499,4 @@ public class TaskController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user