发布结束插入绩效指标库数据

This commit is contained in:
zhal 2022-08-29 10:33:19 +08:00
parent 3b68106b0a
commit 8bc13c901e
2 changed files with 155 additions and 0 deletions

View File

@ -27,6 +27,7 @@ import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListenerInterface;
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;
@ -122,6 +123,14 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
//绩效模型中数据模型回填流程编号
updateProcessNumber(boN.get("PUBLISHFILEID").toString(),param.getUserContext(),bo.get("WSID").toString(),boN.getString("PUBLISH_NUMBER"));
//插入绩效指标库
insertPerformanceIndicatorLibrary(boN.get("PUBLISHFILEID").toString(),param.getUserContext(),bo.get("WSID").toString(),boN.getString("PUBLISH_NUMBER"));
}
//by bzp 测试编号生成
//new ProcesNumberUtil().getNumber(processInstId);
@ -583,7 +592,153 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
}
}
/**
* 发布流程结束查询关联绩效模型数据插入绩效指标库中
* @return
*/
public String insertPerformanceIndicatorLibrary(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());
List l1l3performanceList=new ArrayList();
l1l3performanceList.add(0,"control.ma");
l1l3performanceList.add(1,publishFileId);
RowMap l1l3performrowMap=DBSql.getMap("SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE EXT2=?",l1l3performanceList.toString());
if(performrowMap!=null || l1l3performrowMap!=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");
ProcessInstance processInst=SDK.getProcessAPI().createBOProcessInstance("obj_1ffbc1e73b99427ca64469e466f97dbe", uc.getUID(), "指标绩效数据插入");
//拿去流程数据填充绩效模型中数据属性
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");
BO recordBO=new BO();
for (int i = 0; i < attributesJsonArray.size(); i++) {
if (attributesJsonArray.getJSONObject(i).containsKey("id")) {
String getid=attributesJsonArray.getJSONObject(i).getString("id");
String value=attributesJsonArray.getJSONObject(i).getString("value");
if(getid.equals("Process_Architecture_L1")){//L1
recordBO.set("PROCESS_ARCHITECTURE_L1",value);
}
if(getid.equals("Process_Architecture_L2")){//L2
recordBO.set("PROCESS_ARCHITECTURE_L2",value);
}
if(getid.equals("Process_Architecture_L3")){//L3
recordBO.set("PROCESS_ARCHITECTURE_L3",value);
}
if(getid.equals("Number_of_the_associated_flow_file")){//关联流程文件编号
recordBO.set("NUMBER_OF_THE_ASSO_FLOW_FILE",value);
}
if(getid.equals("Associated_process_name")){//关联流程名称
recordBO.set("ASSOCIATED_PROCESS_NAME",value);
}
if(getid.equals("Associated_process_name")){//流程绩效指标名称
recordBO.set("PERFORMANCE_INDICATOR_NAME",value);
}
if(getid.equals("Index_properties")){//指标性质
recordBO.set("INDEX_PROPERTIES",value);
}
if(getid.equals("ndicator_User_defined_label")){//指标自定义标签
recordBO.set("NDICATOR_USER_DEFINED_LABEL",value);
}
if(getid.equals("Index_definition")){//指标定义
recordBO.set("INDEX_DEFINITION",value);
}
if(getid.equals("unit_measurement")){//计量单位
recordBO.set("UNIT_MEASUREMENT",value);
}
if(getid.equals("statistical_period")){//统计周期
recordBO.set("STATISTICAL_PERIOD",value);
}
if(getid.equals("computational_formula")){//计算公式
recordBO.set("COMPUTATIONAL_FORMULA",value);
}
if(getid.equals("Data_fetch_logic")){//数据取数逻辑
recordBO.set("DATA_FETCH_LOGIC",value);
}
if(getid.equals("Take_the_number_aperture")){//取数口径
recordBO.set("TAKE_THE_NUMBER_APERTURE",value);
}
if(getid.equals("remark")){//备注
recordBO.set("REMARK",value);
}
if(getid.equals("oa_process")){//OA流程
recordBO.set("OA_PROCESS",value);
}
if(getid.equals("element")){//元素
JSONObject getvalue = attributesJsonArray.getJSONObject(i).getJSONObject("value");
if(getvalue!=null){
JSONArray elejsonArray = attributesJsonArray.getJSONObject(i).getJSONObject("value").getJSONArray("table");
for(int k=1;k<elejsonArray.size();k++){
String name = elejsonArray.getJSONObject(k).get("name").toString();
String desc = elejsonArray.getJSONObject(k).get("desc").toString();
BO eleBO=new BO();
eleBO.set("ELEMENT",name);
eleBO.set("DATASOURCES",desc);
SDK.getBOAPI().create("BO_EU_ELEMENT",eleBO,processInst.getId(),"");
}
}
}
}
}
SDK.getBOAPI().create("BO_EU_PER_IND_LIB",recordBO,processInst.getId(),"");
}
}
}
}
}
return "";
}