是解决活动清单全量查询的代码,以及修改活动清单代码
This commit is contained in:
parent
0c95139822
commit
23cf1a0816
@ -0,0 +1,113 @@
|
||||
package com.actionsoft.apps.coe.pal.publisher;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
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.dw.design.event.DataWindowBeforeLoadEventInterface;
|
||||
import com.actionsoft.bpms.dw.exec.component.DataView;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.BOQueryAPI;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ViewRefishBeforeEvent implements DataWindowBeforeLoadEventInterface {
|
||||
@Override
|
||||
public boolean excute(UserContext userContext, DataView dataView) {
|
||||
|
||||
List<PALRepositoryModel> palRepositoryModels = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getAllCoeProcessLevelByWsId("7d3ca852-a0bd-42e6-80b1-3dcea6f55083");
|
||||
for (PALRepositoryModel palRepositoryModel : palRepositoryModels){
|
||||
String publishFileId = palRepositoryModel.getId();
|
||||
String fileName = palRepositoryModel.getName();
|
||||
|
||||
BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(publishFileId, 0);
|
||||
if (defineModel == null) {
|
||||
continue;
|
||||
}
|
||||
String definition = defineModel.getDefinition();
|
||||
JSONObject definitionJo = JSONObject.parseObject(definition);
|
||||
JSONObject elements = (JSONObject) definitionJo.get("elements");
|
||||
ArrayList<BO> bos = new ArrayList<>();
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
//流程架构等级
|
||||
List<RowMap> processLevel = DBSql.getMaps(String.format("select PROPERTYID,PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PROPERTYID in ('Process_Architecture_L1','Process_Architecture_L2','Process_Architecture_L3','Process_Architecture_L4') AND PLID='%s' ORDER BY PROPERTYID", publishFileId));
|
||||
elements.forEach((k, v) -> {
|
||||
setShapeAttr(bos, publishFileId, (JSONObject) v, fileName, processLevel);
|
||||
});
|
||||
if (bos.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
ProcessInstance processInst = SDK.getProcessAPI().createBOProcessInstance("obj_f188537a313e4c6a9bb44eb65f2a0ecd", userContext.getUID(), "流程清单");
|
||||
BO oldBo = (BO) ((BOQueryAPI) SDK.getBOAPI().query("BO_ACT_PAL_PROCESS_MANIFEST").addQuery("MODELID = ", publishFileId)).detail();
|
||||
if (oldBo != null) {
|
||||
SDK.getBOAPI().removeByBindId("BO_ACT_PAL_PROCESS_MANIFEST", oldBo.getBindId());
|
||||
SDK.getBOAPI().create("BO_ACT_PAL_PROCESS_MANIFEST", bos, processInst, userContext);
|
||||
} else {
|
||||
SDK.getBOAPI().create("BO_ACT_PAL_PROCESS_MANIFEST", bos, processInst, userContext);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将流程模型的形状属性封装到bo集合
|
||||
*
|
||||
* @param bos bos
|
||||
* @param publishFileId 发布文件id
|
||||
* @param shape 形状
|
||||
* @param fileName 文件名称
|
||||
*/
|
||||
private void setShapeAttr(ArrayList<BO> bos, String publishFileId, JSONObject shape, String fileName, List<RowMap> processLevel) {
|
||||
//只需要活动节点
|
||||
if (shape.containsKey("category") && !shape.getString("title").equals("开始/结束")) {
|
||||
BO bo = new BO();
|
||||
bo.set("MODELNAME", fileName);
|
||||
bo.set("MODELID", publishFileId);
|
||||
bo.set("MODELTYPE", shape.getString("category"));
|
||||
bo.set("SHAPETYPE", shape.getString("title"));
|
||||
bo.set("SHAPENAME", shape.getString("text"));
|
||||
//插入流程架构等级
|
||||
for (int i = 0; i < processLevel.size(); i++) {
|
||||
bo.set("L" + (i + 1), processLevel.get(i).getString("PROPERTYVALUE"));
|
||||
}
|
||||
if (shape.containsKey("dataAttributes")) {
|
||||
JSONArray dataAttributes = shape.getJSONArray("dataAttributes");
|
||||
if (dataAttributes.size() > 0) {
|
||||
JSONObject attributesJson = dataAttributes.getJSONObject(dataAttributes.size() - 1);
|
||||
if (attributesJson.containsKey("attributesJsonArray")) {
|
||||
//形状的属性
|
||||
JSONArray attributesJsonArray = attributesJson.getJSONArray("attributesJsonArray");
|
||||
attributesJsonArray.stream()
|
||||
.filter(a -> a != null && !"null".equals(a.toString()) && ((JSONObject) a).size() > 0)
|
||||
.forEach(a -> {
|
||||
JSONObject shapeAttr = (JSONObject) a;
|
||||
if (shapeAttr.get("key").equals("activity_number")) {
|
||||
bo.set("SHAPENUMBER", shapeAttr.getString("value"));
|
||||
}
|
||||
if (shapeAttr.get("key").equals("output")) {
|
||||
bo.set("EXTOUTPUT", shapeAttr.getString("value"));
|
||||
}
|
||||
if (shapeAttr.get("key").equals("input")) {
|
||||
bo.set("EXTINPUT", shapeAttr.getString("value"));
|
||||
}
|
||||
if (shapeAttr.get("key").equals("activity_description")) {
|
||||
bo.set("EXTDESC", shapeAttr.getString("value"));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
bos.add(bo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4572,7 +4572,7 @@ public class ProcessPublishWeb extends ActionWeb {
|
||||
BO oldBo = (BO) ((BOQueryAPI) SDK.getBOAPI().query("BO_ACT_PAL_PROCESS_MANIFEST").addQuery("MODELID = ", publishFileId)).detail();
|
||||
if (oldBo != null) {
|
||||
SDK.getBOAPI().removeByBindId("BO_ACT_PAL_PROCESS_MANIFEST", oldBo.getBindId());
|
||||
SDK.getBOAPI().create("BO_ACT_PAL_PROCESS_MANIFEST", bos, processInst, _uc);
|
||||
SDK.getBOAPI().create("BO_ACT_PAL_PROCESS_MANIFEST", bos, processInst, _uc);
|
||||
} else {
|
||||
SDK.getBOAPI().create("BO_ACT_PAL_PROCESS_MANIFEST", bos, processInst, _uc);
|
||||
}
|
||||
|
||||
@ -144,19 +144,19 @@ public class SyncFrameData_job_Controller {
|
||||
} else {
|
||||
bo.set("L1", name1);
|
||||
bo.set("L2", name2);
|
||||
bo.set("L3", name4);
|
||||
bo.set("L3", name1);
|
||||
bo.set("L4", "/");
|
||||
bo.set("LEVELS", "4");
|
||||
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '4' WHERE ID ='"+uuid+"' AND PLMETHODID != 'process.framework'");
|
||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L4", "/");
|
||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L3", name4);
|
||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L3", name1);
|
||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L1", name2);
|
||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", name1);
|
||||
}
|
||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", name4);
|
||||
} //L3 -L1 -L2
|
||||
|
||||
} else {
|
||||
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '3' WHERE ID ='"+uuid+"' AND PLMETHODID != 'process.framework'");
|
||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", name4);
|
||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", name1);
|
||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L3", "/");
|
||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L4", "/");
|
||||
bo.set("L1", name1);
|
||||
@ -164,7 +164,7 @@ public class SyncFrameData_job_Controller {
|
||||
bo.set("L3", "/");
|
||||
bo.set("L4", "/");
|
||||
bo.set("LEVELS", "3");
|
||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L1", name1);
|
||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L1", name4);
|
||||
|
||||
}
|
||||
}else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user