发布流程代码提交

This commit is contained in:
zhaol 2024-10-22 21:08:30 +08:00
parent a57daa2cbd
commit 9e6d37ab67

View File

@ -16,9 +16,12 @@ import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.DesignerShapeRelationCache;
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.publisher.utils.DeleteGptFilesUtils;
import com.actionsoft.apps.coe.pal.publisher.utils.UploadGptFileUtils;
import com.actionsoft.apps.coe.pal.system.util.StringUtil;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.exception.AWSDataAccessException;
import com.actionsoft.sdk.local.api.BOQueryAPI;
import org.apache.commons.lang.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
@ -73,6 +76,13 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
private String isSendKMS = SDK.getAppAPI().getProperty("com.actionsoft.apps.coe.pal.publisher", "isSendKMS");
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");
private int sendTotal;
@Override
@ -453,8 +463,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
}*/
// 二次推送
}
}
@ -505,19 +513,19 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
for (BO bo : bo_act_coe_publish_n) {
try {
String fileId = bo.getString("PUBLISHFILEID");
DBSql.update(open,"UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '1' WHERE ID = '"+fileId+"'");
DBSql.update(open, "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '1' WHERE ID = '" + fileId + "'");
/**
* 更新部门视图EXT6字段
*/
List<RowMap> rlatRowMap=DBSql.getMaps("SELECT RELATIONSHAPETEXT FROM APP_ACT_COE_PAL_SHAPE_RLAT where FILEID = '"+fileId+"' and ATTRID='Issuing_department'");
if(rlatRowMap.size()>0){
List<RowMap> 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);
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);
@ -530,6 +538,49 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
}
}
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(processExecutionContext.getUserContext(), dcProfile, appProfile.getAppContext().getId(),
model.getWsId(), rowMap.getString("TASKID"), filename + "_" + lever + ".doc");
System.out.println("dcContext=========" + dcContext.getDownloadURL());
String filepath = dcContext.getFilePath();
String finalFilePath = filepath.replace("bin\\..\\", "");
String result=UploadGptFileUtils.uploadGptFile(uploadGptUrl,appkey,requestCode,dcContext.getFilePath());
if(result!=null){
//插入模型ID与DOCID对应表中
BO gptBO=new BO();
gptBO.set("plid",fileId);
gptBO.set("docid",result);
SDK.getBOAPI().create("BO_EU_GPT_DOCFILE", gptBO, processExecutionContext.getProcessInstance().getId(), processExecutionContext.getProcessInstance().getCreateUser());
}
}
@ -573,34 +624,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
DBSql.update(open,"UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '1' WHERE ID = '"+changefileIdNew+"'");
/**
* 更新部门视图EXT6字段
*/
/* Map<String, JSONObject> queryRepositoryAttributeById = new RepositoryAttribute().queryRepositoryAttributeById(changefileIdNew);
if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) {
// 发布部门
String dempId = "";
JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department");
if (null != Issuing_department && !Issuing_department.equals("")) {
JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value");
SDK.getLogAPI().consoleInfo(Issuing_department.toString());
if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) {
for (Object PUBDEPTO : PUBDEPTJA) {
JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO));
dempId += PUBDEPTJO.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);
}
}
}
}*/
/**
* 更新部门视图EXT6字段
@ -625,6 +648,70 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
}
//先查找旧文件
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);
DeleteGptFilesUtils.deleteGptFiles(deleteGptUrl,jsonRequest.toJSONString(),appkey);
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(processExecutionContext.getUserContext(), dcProfile, appProfile.getAppContext().getId(),
model.getWsId(), rowMap.getString("TASKID"), filename + "_" + lever + ".doc");
System.out.println("dcContext=========" + dcContext.getDownloadURL());
String filepath = dcContext.getFilePath();
String finalFilePath = filepath.replace("bin\\..\\", "");
String result = UploadGptFileUtils.uploadGptFile(uploadGptUrl, appkey, requestCode, dcContext.getFilePath());
if (result != null) {
//插入模型ID与DOCID对应表中
BO gptBO = new BO();
gptBO.set("plid", changefileIdNew);
gptBO.set("docid", result);
SDK.getBOAPI().create("BO_EU_GPT_DOCFILE", gptBO, processExecutionContext.getProcessInstance().getId(), processExecutionContext.getProcessInstance().getCreateUser());
}
}
}
} catch (Exception e) {
}
}
@ -667,7 +754,14 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
}
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);
}
} catch (Exception e) {