diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/Plugins.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/Plugins.java index f5dba0ae..bb757cd1 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/Plugins.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/Plugins.java @@ -5,10 +5,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import com.actionsoft.apps.coe.pal.publisher.alsp.SendEHSQAlsp; -import com.actionsoft.apps.coe.pal.publisher.alsp.SendKMSAlsp; -import com.actionsoft.apps.coe.pal.publisher.alsp.SendOAAlsp; -import com.actionsoft.apps.coe.pal.publisher.alsp.SendOAReadAlsp; +import com.actionsoft.apps.coe.pal.publisher.alsp.*; import com.actionsoft.apps.coe.pal.publisher.at.*; import com.actionsoft.apps.coe.pal.publisher.client.web.ProcessPublishClientWeb; import com.actionsoft.apps.coe.pal.publisher.client.web.ProcessPublishWeb; @@ -168,13 +165,15 @@ public class Plugins implements PluginListener { - list.add(new ASLPPluginProfile("SendOAAlsp", SendOAAlsp.class.getName(), "OA系统请求调用请求调用", new HttpASLP(HttpASLP.AUTH_AWS_SID))); + list.add(new ASLPPluginProfile("SendOAAslp", SendOAAslp.class.getName(), "OA系统请求调用请求调用", new HttpASLP(HttpASLP.AUTH_AWS_SID))); - list.add(new ASLPPluginProfile("SendKMSAlsp", SendKMSAlsp.class.getName(), "KMS调用", new HttpASLP(HttpASLP.AUTH_AWS_SID))); + list.add(new ASLPPluginProfile("SendKMSAslp", SendKMSAslp.class.getName(), "KMS调用", new HttpASLP(HttpASLP.AUTH_AWS_SID))); - list.add(new ASLPPluginProfile("SendEHSQAlsp", SendEHSQAlsp.class.getName(), "EHSQ调用", new HttpASLP(HttpASLP.AUTH_AWS_SID))); + list.add(new ASLPPluginProfile("SendEHSQAslp", SendEHSQAlsp.class.getName(), "EHSQ调用", new HttpASLP(HttpASLP.AUTH_AWS_SID))); - list.add(new ASLPPluginProfile("SendOAReadAlsp", SendOAReadAlsp.class.getName(), "OA待阅接口ALSP", new HttpASLP(HttpASLP.AUTH_AWS_SID))); + list.add(new ASLPPluginProfile("SendOAReadAslp", SendOAReadAslp.class.getName(), "OA待阅接口ALSP", new HttpASLP(HttpASLP.AUTH_AWS_SID))); + + list.add(new ASLPPluginProfile("UpdateDepViewAslp", UpdateDepViewAslp.class.getName(), "更新部门视图是否显示ALSP", new HttpASLP(HttpASLP.AUTH_AWS_SID))); diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendEHSQAlsp.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendEHSQAlsp.java index 2892765d..8910afea 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendEHSQAlsp.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendEHSQAlsp.java @@ -82,13 +82,13 @@ public class SendEHSQAlsp implements ASLP { if ("true".equals(isSendEHSQ)&&sendEhqs) { try { // 推送EHSQ - if(bo_act_coe_publish_n.size()>0) { + /*if(bo_act_coe_publish_n.size()>0) { processEndAfterEventNew.sendEHSQ(processInstance, bo_act_coe_publish_n,taskInstance,sid); } // 更新EHSQ if(bo_act_coe_publish_c.size()>0) { processEndAfterEventNew.updateEHSQ(processInstance, bo_act_coe_publish_c,taskInstance,sid); - } + }*/ } catch (Exception e) { // TODO: handle exception } diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendGPTAlsp.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendGPTAlsp.java new file mode 100644 index 00000000..7a190c1f --- /dev/null +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendGPTAlsp.java @@ -0,0 +1,203 @@ +package com.actionsoft.apps.coe.pal.publisher.alsp; + +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.publisher.utils.DeleteGptFilesUtils; +import com.actionsoft.apps.coe.pal.publisher.utils.UploadGptFileUtils; +import com.actionsoft.apps.resource.interop.aslp.ASLP; +import com.actionsoft.apps.resource.interop.aslp.Meta; +import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile; +import com.actionsoft.bpms.bo.engine.BO; +import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance; +import com.actionsoft.bpms.commons.database.RowMap; +import com.actionsoft.bpms.commons.mvc.view.ResponseObject; +import com.actionsoft.bpms.server.UserContext; +import com.actionsoft.bpms.server.fs.DCContext; +import com.actionsoft.bpms.util.DBSql; +import com.actionsoft.exception.AWSException; +import com.actionsoft.sdk.local.SDK; +import com.alibaba.fastjson.JSONObject; + +import java.util.List; +import java.util.Map; + +/** + * 发送GTPALSP + */ +public class SendGPTAlsp implements ASLP { + + private String uploadGptUrl = SDK.getAppAPI().getProperty("com.actionsoft.apps.coe.pal.publisher", "uploadGptUrl"); + private String deleteGptUrl = SDK.getAppAPI().getProperty("com.actionsoft.apps.coe.pal.publisher", "deleteGptUrl"); + private String appkey = SDK.getAppAPI().getProperty("com.actionsoft.apps.coe.pal.publisher", "appkey"); + private String requestCode = SDK.getAppAPI().getProperty("com.actionsoft.apps.coe.pal.publisher", "requestCode"); + + @Override + @Meta(parameter = {"name:'processId',required:true,desc:'流程ID'", + "name:'taskId',required:true,desc:'任务ID'", + "name:'sid',required:true,desc:'sid'", + "name:'isSendEHSQ',required:true,desc:'isSendEHSQ'", + }) + public ResponseObject call(Map map) { + try { + String processId = String.valueOf(map.get("processId")); + String sid = String.valueOf(map.get("sid")); + + ProcessInstance processinstance = SDK.getProcessAPI().getInstanceById(processId); + UserContext uc = UserContext.fromSessionId(sid); + List bo_act_coe_publish_n = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true) + .addQuery("BINDID=", processId).list(); + List bo_act_coe_publish_c = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true) + .addQuery("BINDID=", processId).list(); + List bo_act_coe_publish_s = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S", true) + .addQuery("BINDID=", processId).list(); + + if (bo_act_coe_publish_n.size() > 0) { + for (BO bo : bo_act_coe_publish_n) { + + String fileId = bo.getString("PUBLISHFILEID"); + RowMap rowMap = DBSql.getMap("SELECT * FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID='" + fileId + "'"); + + OutputTaskModel model = new OutputTask().getTaskReportById(rowMap.getString("TASKID")); + if (model != null) { + OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId()); + if (appProfile == null) { + throw new AWSException("Not Find OutputAppProfile! profileId=" + model.getProfileId()); + } + DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), + OutputConst.EXT_APP_DC_OUTPUT); + if (dcProfile == null) + throw new AWSException( + "Not Find DCProfile! repositoryName=" + OutputConst.EXT_APP_DC_OUTPUT); + String sql_lever = sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '" + + rowMap.getString("PUBLISHFILEID") + "'"; + String lever = DBSql.getString(sql_lever); + // lever = lever.substring(0,3); + if (lever.length() == 5 && lever.substring(4).equals("0")) { + lever.substring(0, 3); + } else if (lever.length() == 1) { + lever = lever + ".0"; + } + String filename = rowMap.getString("PUBLISHFILENAME"); + + DCContext dcContext = new DCContext(uc, dcProfile, appProfile.getAppContext().getId(), + model.getWsId(), rowMap.getString("TASKID"), filename + "_" + lever + ".doc"); + + + String filepath = dcContext.getFilePath(); + String finalFilePath = filepath.replace("bin\\..\\", ""); + + JSONObject result = null; + result = JSONObject.parseObject(UploadGptFileUtils.uploadGptFile(uploadGptUrl, appkey, requestCode, dcContext.getFilePath())); + if (result.getString("msg").equals("success")) { + String data = result.getString("data"); + //插入模型ID与DOCID对应表中 + BO gptBO = new BO(); + gptBO.set("plid", fileId); + gptBO.set("docid", data); + ProcessInstance boProcessInstance = SDK.getProcessAPI() + .createBOProcessInstance("obj_08d91b102a514d49b5b42ed439de94c4", uc.getUID(), "GPT文件"); + SDK.getBOAPI().create("BO_EU_GPT_DOCFILE", gptBO, boProcessInstance.getId(), processinstance.getCreateUser()); + } + } + + } + } + + + if (bo_act_coe_publish_c.size() > 0) { + for (BO bo : bo_act_coe_publish_c) { + + String changefileId = bo.getString("CHANGEFILEID"); + String changefileIdNew = bo.getString("CHANGEDFILEIDNEW"); + //先查找旧文件 + BO docfile = SDK.getBOAPI().query("BO_EU_GPT_DOCFILE").addQuery("PLID=", changefileId).detail(); + if (docfile != null) { + String docid = docfile.getString("DOCID"); + JSONObject jsonRequest = new JSONObject(); + jsonRequest.put("requestCode", requestCode); + jsonRequest.put("docId", docid); + String deleteResult = DeleteGptFilesUtils.deleteGptFiles(deleteGptUrl, jsonRequest.toJSONString(), appkey); + SDK.getBOAPI().remove("BO_EU_GPT_DOCFILE", docfile.getId()); + RowMap rowMap = DBSql + .getMap("SELECT * FROM BO_ACT_COE_PUBLISH_C WHERE PUBLISHFILEID=" + changefileIdNew + ""); + + OutputTaskModel model = new OutputTask().getTaskReportById(rowMap.getString("TASKID")); + if (model != null) { + OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId()); + if (appProfile == null) { + throw new AWSException("Not Find OutputAppProfile! profileId=" + model.getProfileId()); + } + DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), + OutputConst.EXT_APP_DC_OUTPUT); + if (dcProfile == null) + throw new AWSException( + "Not Find DCProfile! repositoryName=" + OutputConst.EXT_APP_DC_OUTPUT); + String sql_lever = sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '" + + rowMap.getString("CHANGEDFILEIDNEW") + "'"; + + String lever = DBSql.getString(sql_lever); + // lever = lever.substring(0,3); + if (lever.length() == 5 && lever.substring(4).equals("0")) { + lever.substring(0, 3); + } else if (lever.length() == 1) { + lever = lever + ".0"; + } + String filename = rowMap.getString("CHANGEDFILENAMENEW"); + DCContext dcContext = new DCContext(uc, dcProfile, appProfile.getAppContext().getId(), + model.getWsId(), rowMap.getString("TASKID"), filename + "_" + lever + ".doc"); + + + String filepath = dcContext.getFilePath(); + String finalFilePath = filepath.replace("bin\\..\\", ""); + + JSONObject result = JSONObject.parseObject(UploadGptFileUtils.uploadGptFile(uploadGptUrl, appkey, requestCode, dcContext.getFilePath())); + + if (result.getString("msg").equals("success")) { + String data = result.getString("data"); + //插入模型ID与DOCID对应表中 + BO gptBO = new BO(); + gptBO.set("plid", changefileIdNew); + gptBO.set("docid", data); + ProcessInstance boProcessInstance = SDK.getProcessAPI() + .createBOProcessInstance("obj_08d91b102a514d49b5b42ed439de94c4", uc.getUID(), "GPT文件"); + SDK.getBOAPI().create("BO_EU_GPT_DOCFILE", gptBO, boProcessInstance.getId(), processinstance.getCreateUser()); + } + + } + + + } + + } + } + + if (bo_act_coe_publish_s.size() > 0) { + for (BO bo : bo_act_coe_publish_s) { + String fileId = bo.getString("STOPFILEID"); + + BO docfile = SDK.getBOAPI().query("BO_EU_GPT_DOCFILE").addQuery("PLID=", fileId).detail(); + if (docfile != null) { + String docid = docfile.getString("DOCID"); + JSONObject jsonRequest = new JSONObject(); + jsonRequest.put("requestCode", requestCode); + jsonRequest.put("docId", docid); + DeleteGptFilesUtils.deleteGptFiles(deleteGptUrl, jsonRequest.toJSONString(), appkey); + SDK.getBOAPI().remove("BO_EU_GPT_DOCFILE", docfile.getId()); + } + } + } + + } catch (Exception e) { + e.printStackTrace(); + } finally { + } + + + + return null; + } + +} diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendKMSAlsp.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendKMSAslp.java similarity index 93% rename from com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendKMSAlsp.java rename to com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendKMSAslp.java index e074df03..9fcbbb3d 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendKMSAlsp.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendKMSAslp.java @@ -33,18 +33,17 @@ import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.*; -public class SendKMSAlsp implements ASLP { +public class SendKMSAslp implements ASLP { @Override @Meta(parameter = {"name:'processId',required:true,desc:'流程实例ID'", "name:'sid',required:true,desc:'sid'"}) public ResponseObject call(Map map) { - System.out.println("开始进入KMS方法中"); ResponseObject ro = ResponseObject.newWarnResponse("结果未知"); + Connection open = DBSql.open(); try { String processId = String.valueOf(map.get("processId")); - Connection open = DBSql.open(); String sid = String.valueOf(map.get("sid")); //查询发布表数据 @@ -112,17 +111,16 @@ public class SendKMSAlsp implements ASLP { new_uid = new_uid.join(",", sendList); - try { // 发布到知识库 int m = 0; - for (BO bo : bo_act_coe_publish_n) { + /* for (BO bo : bo_act_coe_publish_n) { processEndAfterEvent_new.createKmsByNew(bo, wsId, filed, processInstance, bo_act_coe_publish, new_uid, sid); } // 更新知识库 for (BO bo : bo_act_coe_publish_c) { processEndAfterEvent_new.CreateKmsByupdate(bo, wsId, filed, processInstance, bo_act_coe_publish, new_uid, sid); - } + }*/ // 废止知识库文件 for (BO bo : bo_act_coe_publish_s) { @@ -136,7 +134,7 @@ public class SendKMSAlsp implements ASLP { String ext4=plmodel.getExt4(); /*RowMap map1 = DBSql.getMap(open, sql_s);*/ - if (StringUtils.isNotEmpty(ext4)) { + /* if (StringUtils.isNotEmpty(ext4)) { processEndAfterEvent_new.CancelPublishKnwl(processInstance, sid, ext4); @@ -145,17 +143,17 @@ public class SendKMSAlsp implements ASLP { + publishfileid_stop + "'"); - } + }*/ } - } catch (Exception e) { - System.out.println("KMS知识库创建异常====" + bo_act_coe_publish_n); - // TODO: handle exception - e.printStackTrace(); - } + + + } catch (Exception e) { e.printStackTrace(); ro = ResponseObject.newErrResponse(e.getMessage()); + }finally { + DBSql.close(open); } diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendOAAlsp.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendOAAslp.java similarity index 90% rename from com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendOAAlsp.java rename to com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendOAAslp.java index 83fd60b6..6caa3607 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendOAAlsp.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendOAAslp.java @@ -32,7 +32,7 @@ import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.*; -public class SendOAAlsp implements ASLP { +public class SendOAAslp implements ASLP { @Override @@ -42,21 +42,25 @@ public class SendOAAlsp implements ASLP { }) public ResponseObject call(Map map) { ResponseObject ro = ResponseObject.newWarnResponse("结果未知"); + Connection open = DBSql.open(); try { + System.out.println("SendOAAslp=========="); String processId = String.valueOf(map.get("processId")); String taskId = String.valueOf(map.get("taskId")); String sid = String.valueOf(map.get("sid")); - Connection open = DBSql.open(); + ProcessEndAfterEvent_new processEndAfterEventNew = new ProcessEndAfterEvent_new(); ProcessInstance processInstance = SDK.getProcessAPI().getInstanceById(processId); TaskInstance taskInstance = SDK.getTaskAPI().getInstanceById(taskId); - processEndAfterEventNew.ProcessData(processInstance, taskInstance, open, sid); + //processEndAfterEventNew.ProcessData(processInstance, taskInstance, open, sid); } catch (Exception e) { e.printStackTrace(); ro = ResponseObject.newErrResponse(e.getMessage()); + }finally { + DBSql.close(open); } return ro; } diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendOAReadAlsp.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendOAReadAslp.java similarity index 97% rename from com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendOAReadAlsp.java rename to com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendOAReadAslp.java index 0073591b..7ee36a6a 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendOAReadAlsp.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/SendOAReadAslp.java @@ -28,7 +28,7 @@ import java.util.*; /** * 发送OA待阅 */ -public class SendOAReadAlsp implements ASLP { +public class SendOAReadAslp implements ASLP { private int sendTotal; @@ -39,7 +39,6 @@ public class SendOAReadAlsp implements ASLP { }) public ResponseObject call(Map map) { - System.out.println("即将开始进入方法体========================"); Connection conn =null; ResponseObject ro = ResponseObject.newWarnResponse("结果未知"); try { @@ -47,9 +46,6 @@ public class SendOAReadAlsp implements ASLP { String userIds = String.valueOf(map.get("userIds")); String type = String.valueOf(map.get("type")); - System.out.println("processId=========="+processId); - System.out.println("userIds=========="+userIds); - System.out.println("type=========="+type); conn=DBSql.open(); ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processId); diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/UpdateDepViewAslp.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/UpdateDepViewAslp.java new file mode 100644 index 00000000..70678e0d --- /dev/null +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/alsp/UpdateDepViewAslp.java @@ -0,0 +1,176 @@ +package com.actionsoft.apps.coe.pal.publisher.alsp; + +import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; +import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory; +import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository; +import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao; +import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.dao.DesignerShapeRelationDao; +import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel; +import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; +import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl; +import com.actionsoft.apps.resource.interop.aslp.ASLP; +import com.actionsoft.apps.resource.interop.aslp.Meta; +import com.actionsoft.bpms.bo.engine.BO; +import com.actionsoft.bpms.commons.database.RowMap; +import com.actionsoft.bpms.commons.mvc.view.ResponseObject; +import com.actionsoft.bpms.server.UserContext; +import com.actionsoft.bpms.util.DBSql; +import com.actionsoft.bpms.util.UUIDGener; +import com.actionsoft.sdk.local.SDK; +import com.alibaba.fastjson.JSONObject; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; + +public class UpdateDepViewAslp implements ASLP { + + + + @Override + @Meta(parameter = {"name:'processId',required:true,desc:'流程ID'", + "name:'sid',required:true,desc:'用户会话ID'" + }) + public ResponseObject call(Map map) { + ResponseObject ro = ResponseObject.newWarnResponse("结果未知"); + + + try { + String processId = String.valueOf(map.get("processId")); + String sid = String.valueOf(map.get("sid")); + UserContext uc=UserContext.fromSessionId(sid); + // 流程发布的新增发布 + List bolistN = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true) + .addQuery("BINDID=", processId).list(); + List bolistC = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true) + .addQuery("BINDID=", processId).list(); + List bolistS = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S", true) + .addQuery("BINDID=", processId).list(); + + if (bolistN != null) { + for (BO boN : bolistN) { + String fileId = boN.getString("PUBLISHFILEID"); + /** + * 更新部门视图EXT6字段 + */ + List rlatRowMap = DBSql.getMaps("SELECT RELATIONSHAPETEXT FROM APP_ACT_COE_PAL_SHAPE_RLAT where FILEID='" + fileId + "' and ATTRID='Issuing_department'"); + if (rlatRowMap.size() > 0) { + // 发布部门 + String dempId = ""; + for (RowMap oneRowMap : rlatRowMap) { + String relationshapetext = oneRowMap.getString("RELATIONSHAPETEXT"); + JSONObject js = JSONObject.parseObject(relationshapetext); + dempId += js.getString("id") + ","; + } + dempId = dempId.substring(0, dempId.length() - 1); + + PALRepositoryModelImpl plModel = (PALRepositoryModelImpl) PALRepositoryCache.getCache().get(fileId); + int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6=TO_CLOB('" + dempId + "'),EXT5=1 WHERE ID='" + fileId + "'"); + if(count>0){ + if (plModel != null) { + PALRepositoryCache.getCache().put(fileId, plModel); + } + } + + } + + } + } + + + if (bolistC != null) { + for (BO boC : bolistC) { + String changefileId = boC.getString("CHANGEFILEID"); + String changefileIdNew = boC.getString("CHANGEDFILEIDNEW"); + + //PALRepository palRepository=new PALRepository(); + //palRepository.updateRepositoryExtAll(changefileId,"","","","","0",""); + //palRepository.updateRepositoryExtAll(changefileIdNew,"","","","","1",""); + + /*DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='0' WHERE ID='"+changefileId+"'"); + DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='1' WHERE ID='"+changefileIdNew+"'");*/ + + /** + * 更新部门视图EXT6字段 + */ + List rlatRowMap=DBSql.getMaps("SELECT RELATIONSHAPETEXT FROM APP_ACT_COE_PAL_SHAPE_RLAT where FILEID='"+changefileIdNew+"' and ATTRID='Issuing_department'"); + if(rlatRowMap.size()>0){ + // 发布部门 + String dempId = ""; + for(RowMap oneRowMap:rlatRowMap){ + String relationshapetext=oneRowMap.getString("RELATIONSHAPETEXT"); + JSONObject js=JSONObject.parseObject(relationshapetext); + dempId += js.getString("id") + ","; + } + dempId = dempId.substring(0, dempId.length() - 1); + + /* int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6=TO_CLOB('" + dempId + "') WHERE ID='" + changefileIdNew + "'"); + PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(changefileIdNew); + if (plModel != null) { + PALRepositoryCache.getCache().put(changefileIdNew, plModel); + }*/ + PALRepositoryModelImpl plModel = (PALRepositoryModelImpl) PALRepositoryCache.getCache().get(changefileIdNew); + int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6=TO_CLOB('" + dempId + "'),EXT5=1 WHERE ID='" + changefileIdNew + "'"); + int changeFiledCount=DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='0' WHERE ID='"+changefileId+"'"); + if(count>0){ + if (plModel != null) { + PALRepositoryCache.getCache().put(changefileIdNew, plModel); + } + } + + + } + } + } + if (bolistS != null) { + for (BO boS : bolistS) { + String fileId = boS.get("STOPFILEID").toString(); + //palRepository.updateRepositoryExtAll(fileId,"","","","","0",""); + + PALRepositoryModelImpl plModel = (PALRepositoryModelImpl) PALRepositoryCache.getCache().get(fileId); + int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5=0 WHERE ID='" + fileId + "'"); + if(count>0){ + if (plModel != null) { + PALRepositoryCache.getCache().put(fileId, plModel); + } + } + + //DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='0' WHERE ID='"+fileId+"'"); + + + DesignerShapeRelationModel designerShapeRelationModel=new DesignerShapeRelationModel(); + designerShapeRelationModel.setId(UUIDGener.getUUID()); + designerShapeRelationModel.setFileId(fileId); + designerShapeRelationModel.setAttrId("nullifier"); + designerShapeRelationModel.setRelationFileId("00000000-0000-0000-0000-000000000000"); + designerShapeRelationModel.setRelationShapeId("00000000-0000-0000-0000-000000000000"); + + JSONObject js=new JSONObject(); + js.put("name", uc.getUserName()); + js.put("id",uc.getUID()); + js.put("type", "user"); + + designerShapeRelationModel.setRelationShapeText(js.toString()); + + DesignerShapeRelationDao dao = new DesignerShapeRelationDao(); + dao.insert(designerShapeRelationModel); + + PALRepositoryPropertyDao propertyDao = new PALRepositoryPropertyDao(); + //作废时间 + Date date=new Date(); + SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd"); + propertyDao.updatePropertyByPropertyId(fileId, "obsolescence_time", sdfs.format(date)); + + if (plModel != null) { + PALRepositoryCache.getCache().put(fileId, plModel); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + ro = ResponseObject.newErrResponse(e.getMessage()); + } + return ro; + } +} diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/util/ProcesNumberUtil.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/util/ProcesNumberUtil.java index a0a8ae4e..81ab7467 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/util/ProcesNumberUtil.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/util/ProcesNumberUtil.java @@ -143,11 +143,10 @@ public class ProcesNumberUtil { if (!"".equals(plvers)) { if (plvers.length() > 1) { if(plvers.contains(".")){ - plver = plvers.substring(0,plvers.indexOf(".")) + "." + plvers.substring(plvers.length() - 1, plvers.length()); + plver = processString(plvers); }else{ plver = plvers+ ".0"; } - } else { plver = plvers.substring(0, 1) + ".0"; } @@ -274,7 +273,7 @@ public class ProcesNumberUtil { if (!"".equals(plvers)) { if (plvers.length() > 1) { if(plvers.contains(".")){ - plver = plvers.substring(0,plvers.indexOf(".")) + "." + plvers.substring(plvers.length() - 1, plvers.length()); + plver = processString(plvers); }else{ plver = plvers+ ".0"; } @@ -409,7 +408,7 @@ public class ProcesNumberUtil { if (!"".equals(plvers)) { if (plvers.length() > 1) { if(plvers.contains(".")){ - plver = plvers.substring(0,plvers.indexOf(".")) + "." + plvers.substring(plvers.length() - 1, plvers.length()); + plver = processString(plvers); }else{ plver = plvers+ ".0"; } @@ -433,4 +432,20 @@ public class ProcesNumberUtil { } return "OK"; } + + + public static String processString(String input) { + // 按逗号分割字符串 + String[] parts = input.split("\\."); + + // 获取逗号前面的部分 + String beforeComma = parts[0]; + + // 获取逗号后面的部分并转换为整数 + int afterComma = Integer.parseInt(parts[1]); + + // 拼接结果 + return beforeComma +"."+ afterComma; + } + } diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java index a8946bdf..c846abe5 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java @@ -5202,7 +5202,7 @@ public class ProcessPublishWeb extends ActionWeb { processDefId = SDK.getRepositoryAPI().getProcessDefIdOfRelease("obj_fb1c7a54b98b412187388c8bab407362"); }else{ //获取发布流程运行中的版本 - processDefId = SDK.getRepositoryAPI().getProcessDefIdOfRelease("obj_5042cc444c1944c4aaf99001c23d0e4f\n"); + processDefId = SDK.getRepositoryAPI().getProcessDefIdOfRelease("obj_5042cc444c1944c4aaf99001c23d0e4f"); } String optionType = "";//发布类型 String subBoName = "";//子表名称 diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java index c4dd04ac..36ba33cf 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java @@ -516,9 +516,10 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute String fileId = bo.getString("PUBLISHFILEID"); PALRepositoryModelImpl newplModel = (PALRepositoryModelImpl) PALRepositoryCache.getCache().get(fileId); - int newplmodel=DBSql.update(open, "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='1' WHERE ID='" + fileId + "'"); - if(newplmodel>0){ + int newplcount=DBSql.update(open, "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='1' WHERE ID='" + fileId + "'"); + if(newplcount>0){ if (newplModel != null) { + newplModel.setExt5("1"); PALRepositoryCache.getCache().put(fileId, newplModel); } } @@ -541,9 +542,9 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute PALRepositoryModelImpl deplModel = (PALRepositoryModelImpl) PALRepositoryCache.getCache().get(fileId); int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6=TO_CLOB('" + dempId + "') WHERE ID='" + fileId + "'"); - if(count>0){ if (deplModel != null) { + deplModel.setExt6(dempId); PALRepositoryCache.getCache().put(fileId, deplModel); } } @@ -551,7 +552,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute } RowMap rowMap = DBSql - .getMap("SELECT * FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID=" +fileId+""); + .getMap("SELECT * FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID='" +fileId+"'"); OutputTaskModel model = new OutputTask().getTaskReportById(rowMap.getString("TASKID")); if (model != null) { @@ -583,20 +584,20 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute String finalFilePath = filepath.replace("bin\\..\\", ""); - /* JSONObject result=JSONObject.parseObject(UploadGptFileUtils.uploadGptFile(uploadGptUrl,appkey,requestCode,dcContext.getFilePath())); + JSONObject result=JSONObject.parseObject(UploadGptFileUtils.uploadGptFile(uploadGptUrl,appkey,requestCode,dcContext.getFilePath())); if(result.getString("msg").equals("success")){ String data=result.getString("data"); //插入模型ID与DOCID对应表中 BO gptBO=new BO(); - gptBO.set("plid",fileId); - gptBO.set("docid",data); + gptBO.set("PLID",fileId); + gptBO.set("DOCID",data); ProcessInstance boProcessInstance = SDK.getProcessAPI() .createBOProcessInstance("obj_08d91b102a514d49b5b42ed439de94c4", processExecutionContext.getUserContext().getUID(), "GPT文件"); SDK.getBOAPI().create("BO_EU_GPT_DOCFILE", gptBO, boProcessInstance.getId(), processExecutionContext.getProcessInstance().getCreateUser()); - }*/ + } } @@ -617,6 +618,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute int changeCount=DBSql.update(open,"UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '0' WHERE ID = '"+changefileId+"'"); if(changeCount>0){ if (changeplModel != null) { + changeplModel.setExt5("0"); PALRepositoryCache.getCache().put(changefileId, changeplModel); } } @@ -625,6 +627,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute int newCount=DBSql.update(open,"UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '1' WHERE ID = '"+changefileIdNew+"'"); if(newCount>0){ if (newplModel != null) { + newplModel.setExt5("1"); PALRepositoryCache.getCache().put(changefileIdNew, newplModel); } } @@ -649,9 +652,9 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute PALRepositoryModelImpl depplModel = (PALRepositoryModelImpl) PALRepositoryCache.getCache().get(changefileIdNew); int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = TO_CLOB('" + dempId + "') WHERE ID = '" + changefileIdNew + "'"); - if(count>0){ if (depplModel != null) { + depplModel.setExt6(dempId); PALRepositoryCache.getCache().put(changefileIdNew, depplModel); } } @@ -662,7 +665,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute //先查找旧文件 - /*BO docfile= SDK.getBOAPI().query("BO_EU_GPT_DOCFILE").addQuery("PLID=", changefileId).detail(); + BO docfile= SDK.getBOAPI().query("BO_EU_GPT_DOCFILE").addQuery("PLID=", changefileId).detail(); if(docfile!=null){ String docid=docfile.getString("DOCID"); @@ -677,7 +680,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute RowMap rowMap = DBSql - .getMap("SELECT * FROM BO_ACT_COE_PUBLISH_C WHERE PUBLISHFILEID=" +changefileIdNew+""); + .getMap("SELECT * FROM BO_ACT_COE_PUBLISH_C WHERE CHANGEDFILEIDNEW='" +changefileIdNew+"'"); OutputTaskModel model = new OutputTask().getTaskReportById(rowMap.getString("TASKID")); if (model != null) { @@ -690,9 +693,8 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute if (dcProfile == null) throw new AWSException( "Not Find DCProfile! repositoryName=" + OutputConst.EXT_APP_DC_OUTPUT); - String sql_lever = sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '" + String sql_lever = sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '" + rowMap.getString("CHANGEDFILEIDNEW") + "'"; - String lever = DBSql.getString(sql_lever); // lever = lever.substring(0,3); if (lever.length() == 5 && lever.substring(4).equals("0")) { @@ -701,6 +703,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute lever = lever + ".0"; } String filename = rowMap.getString("CHANGEDFILENAMENEW"); + DCContext dcContext = new DCContext(processExecutionContext.getUserContext(), dcProfile, appProfile.getAppContext().getId(), model.getWsId(), rowMap.getString("TASKID"), filename + "_" + lever + ".doc"); @@ -714,20 +717,16 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute String data=result.getString("data"); //插入模型ID与DOCID对应表中 BO gptBO=new BO(); - gptBO.set("plid",changefileIdNew); - gptBO.set("docid",data); - + gptBO.set("PLID",changefileIdNew); + gptBO.set("DOCID",data); ProcessInstance boProcessInstance = SDK.getProcessAPI() .createBOProcessInstance("obj_08d91b102a514d49b5b42ed439de94c4", processExecutionContext.getUserContext().getUID(), "GPT文件"); - SDK.getBOAPI().create("BO_EU_GPT_DOCFILE", gptBO, boProcessInstance.getId(), processExecutionContext.getProcessInstance().getCreateUser()); } - } - - }*/ + } } catch (Exception e) { @@ -743,6 +742,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute int count=DBSql.update(open,"UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='0' WHERE ID = '"+fileId+"'"); if(count>0){ if (plModel != null) { + plModel.setExt5("0"); PALRepositoryCache.getCache().put(fileId, plModel); } } @@ -773,7 +773,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute - /*BO docfile= SDK.getBOAPI().query("BO_EU_GPT_DOCFILE").addQuery("PLID=", fileId).detail(); + BO docfile= SDK.getBOAPI().query("BO_EU_GPT_DOCFILE").addQuery("PLID=", fileId).detail(); if(docfile!=null) { String docid = docfile.getString("DOCID"); JSONObject jsonRequest=new JSONObject(); @@ -782,11 +782,12 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute DeleteGptFilesUtils.deleteGptFiles(deleteGptUrl,jsonRequest.toJSONString(),appkey); SDK.getBOAPI().remove("BO_EU_GPT_DOCFILE",docfile.getId()); - }*/ + } } catch (Exception e) { + System.out.println(""); } } } @@ -842,10 +843,10 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute /** * 更新数据看板底表 */ - try { + /*try { AttrSynAslp(processExecutionContext, wsId, filed); } catch (Exception e) { - } + }*/ } catch (Exception e) { @@ -1289,7 +1290,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute * @return */ public boolean AttrSynAslp(ProcessExecutionContext processExecutionContext, String wsId, JSONArray fileId) { - System.out.println(""); // 调用App String sourceAppId = processExecutionContext.getProcessInstance().getAppId(); // aslp服务地址 diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/utils/UploadGptFileUtils.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/utils/UploadGptFileUtils.java index 6c8ef3c4..44855a65 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/utils/UploadGptFileUtils.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/utils/UploadGptFileUtils.java @@ -14,21 +14,25 @@ public class UploadGptFileUtils { public static String uploadGptFile(String targetUrl,String appkey,String requestCode,String filePath) throws Exception { + String result = null; + HttpURLConnection connection=null; + OutputStream output=null; + try { /*String targetUrl = "https://ai-test.digitalyili.com/chatylserver/requestAIForDocQuest/uploadDoc"; String appkey = "CTidBagRfEXF5OTDjQeqmqSA6EvZfYMj"; String requestCode = "bbc058b3f3132b742089998684a91767"; // Replace with your requestCode String filePath = "C:\\Users\\admin\\Desktop\\伊利项目\\伊利集团数据管理办法 (2).docx"; // Replace with your file path*/ - String result = ""; - String boundary = "----WebKitFormBoundary" + System.currentTimeMillis(); - HttpURLConnection connection = (HttpURLConnection) new URL(targetUrl).openConnection(); - connection.setRequestMethod("POST"); - connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); - connection.setRequestProperty("appkey", appkey); - connection.setDoOutput(true); + result = ""; + String boundary = "----WebKitFormBoundary" + System.currentTimeMillis(); + connection = (HttpURLConnection) new URL(targetUrl).openConnection(); + connection.setRequestMethod("POST"); + connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); + connection.setRequestProperty("appkey", appkey); + connection.setDoOutput(true); - OutputStream output = connection.getOutputStream(); - PrintWriter writer = new PrintWriter(new OutputStreamWriter(output, "UTF-8"), true); + output = connection.getOutputStream(); + PrintWriter writer = new PrintWriter(new OutputStreamWriter(output, "UTF-8"), true); // Send analysisType part writer.append("--").append(boundary).append("\r\n"); writer.append("Content-Disposition: form-data; name=\"analysisType\"\r\n"); @@ -66,6 +70,14 @@ public class UploadGptFileUtils { while ((line = reader.readLine()) != null) { result = result + line; } + + } catch (IOException e) { + e.printStackTrace(); + } finally { + if(output!=null){ + output.close(); + } + } return result; }