发布后回填编号

This commit is contained in:
zhal 2022-08-25 15:09:51 +08:00
parent 366142d5a0
commit f56514adeb
3 changed files with 81 additions and 4 deletions

View File

@ -15,8 +15,12 @@ import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
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.manage.CoeDesignerAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel;
import com.actionsoft.apps.coe.pal.pal.repository.web.CoeProcessLevelWeb;
import com.actionsoft.apps.coe.pal.publisher.client.util.ProcessStatusAPIManager;
import com.actionsoft.apps.coe.pal.publisher.constant.PublisherConstant;
import com.actionsoft.bpms.bo.engine.BO;
@ -32,6 +36,7 @@ import com.actionsoft.bpms.util.UtilDate;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.exception.AWSException;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
public class PublishExecuteListenerInterfaceImpl extends ExecuteListener implements ExecuteListenerInterface {
@ -113,6 +118,10 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
//修改关联角色绩效发布状态
updateRoleAndPerformance(boN.get("PUBLISHFILEID").toString(),model.getPublishDate());
//绩效模型中数据模型回填流程编号
updateProcessNumber(boN.get("PUBLISHFILEID").toString(),param.getUserContext(),bo.get("WSID").toString(),boN.getString("PUBLISH_NUMBER"));
}
//by bzp 测试编号生成
//new ProcesNumberUtil().getNumber(processInstId);
@ -483,7 +492,6 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
* 发布明细如果关联角色绩效图不显示在发布界面在流程结束后同步发布
*/
public void updateRoleAndPerformance(String publishFileId,Timestamp publishDate){
List roleList=new ArrayList();
roleList.add(0,"org.role");
roleList.add(1,publishFileId);
@ -494,7 +502,6 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
//修改流程文件的发布属性
repositoryDao.updatePublishStatusAndDate("N", rolerowMap.getString("ID"), null, publishDate);
}
List performanceList=new ArrayList();
performanceList.add(0,"control.kpi");
performanceList.add(1,publishFileId);
@ -506,7 +513,79 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
repositoryDao.updatePublishStatusAndDate("N", performrowMap.getString("ID"), null, publishDate);
}
}
/**
* 发布结束后获取关联绩效模型填充流程编号
* @param publishFileId
* @param publishDate
*/
public void updateProcessNumber(String publishFileId,UserContext uc,String wsId,String processNumber){
//获取关联绩效模型数据
List performanceList=new ArrayList();
performanceList.add(0,"control.kpi");
performanceList.add(1,publishFileId);
RowMap performrowMap=DBSql.getMap("SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE EXT2=?",performanceList.toString());
if(performrowMap!=null){
PALRepositoryModel parentModel = PALRepositoryCache.getCache().get(performrowMap.getString("ID"));
Map<String, Map<String, JSONObject>> methodAttrsMap = new HashMap<>();// 属性存储
Map<String, String> methodValueAttrsMap = new HashMap<>();// 属性存储
//查询对应绩效模型中数据模型进行填充数据
BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(performrowMap.getString("ID"), 0);
CoeProcessLevelWeb coeProcessLevelWeb=new CoeProcessLevelWeb(uc);
String define = defineModel.getDefinition();
JSONObject definition = JSONObject.parseObject(define);
JSONObject elements = definition.getJSONObject("elements");
coeProcessLevelWeb.handleShapeDefaultAttr(wsId, parentModel, elements, methodAttrsMap);
//拿去流程数据填充绩效模型中数据属性
for (String key : elements.keySet()) {
JSONObject shape1 = elements.getJSONObject(key);
if ("linker".equals(shape1.getString("name"))) {
continue;
}
String shapeText = shape1.getString("text");
JSONArray dataAttributes = shape1.getJSONArray("dataAttributes");
if (!dataAttributes.isEmpty() && dataAttributes.size() > 0) {
for (Object attribute : dataAttributes) {
JSONObject obj = (JSONObject) attribute;
if (obj.containsKey("attributesJsonArray")) {
JSONArray attributesJsonArray = obj.getJSONArray("attributesJsonArray");
for (int i = 0; i < attributesJsonArray.size(); i++) {
if (attributesJsonArray.getJSONObject(i).containsKey("id")) {
String getid=attributesJsonArray.getJSONObject(i).getString("id");
if(getid.equals("Number_of_the_associated_flow_file")){
attributesJsonArray.getJSONObject(i).put("value", processNumber);
}
}
}
}
}
}
}
defineModel.setDefinition(definition.toString());
// 保存文件
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// dao操作
}
}
}

View File

@ -406,7 +406,6 @@ function selectPublishData(data, type, pageNumber, start) {
//渲染到前台的流程架构L1L2L3
var param = {
cmd: 'com.actionsoft.apps.coe.pal.publisher_getPublishNameByJs',
processInstId: processInstId,
@ -900,7 +899,6 @@ function publishFlowCheck(data) {
}
}
var param = {
sid : sid,
cmd : "com.actionsoft.apps.coe.pal.publisher_get_publishFlow_files",