发布后去掉MA发布代码

This commit is contained in:
zhal 2022-08-31 13:32:15 +08:00
parent cf2b9ade2f
commit 016a9cc0dc
2 changed files with 228 additions and 155 deletions

View File

@ -35,7 +35,10 @@ import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UUIDGener; import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.bpms.util.UtilDate; import com.actionsoft.bpms.util.UtilDate;
import com.actionsoft.bpms.util.UtilString; import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.exception.AWSAPIException;
import com.actionsoft.exception.AWSDataAccessException;
import com.actionsoft.exception.AWSException; import com.actionsoft.exception.AWSException;
import com.actionsoft.exception.BPMNError;
import com.actionsoft.sdk.local.SDK; import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -128,7 +131,8 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
insertPerformanceIndicatorLibrary(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"));
//回填绩效编号
//createPerformanceNumber(boN.get("PUBLISHFILEID").toString(),param.getUserContext(),bo.get("WSID").toString(),boN.getString("PUBLISH_NUMBER"));
} }
@ -531,65 +535,76 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
*/ */
public void updateProcessNumber(String publishFileId,UserContext uc,String wsId,String processNumber){ public void updateProcessNumber(String publishFileId,UserContext uc,String wsId,String processNumber){
//获取关联绩效模型数据 try {
List performanceList=new ArrayList(); //获取关联绩效模型数据
performanceList.add(0,"control.kpi"); List performanceList=new ArrayList();
performanceList.add(1,publishFileId); 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()); 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<>();// 属性存储 if(performrowMap!=null ){
//查询对应绩效模型中数据模型进行填充数据 PALRepositoryModel parentModel = PALRepositoryCache.getCache().get(performrowMap.getString("ID"));
BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(performrowMap.getString("ID"), 0);
CoeProcessLevelWeb coeProcessLevelWeb=new CoeProcessLevelWeb(uc); String id=performrowMap.getString("ID");;
String define = defineModel.getDefinition();
JSONObject definition = JSONObject.parseObject(define);
JSONObject elements = definition.getJSONObject("elements");
coeProcessLevelWeb.handleShapeDefaultAttr(wsId, parentModel, elements, methodAttrsMap);
//拿去流程数据填充绩效模型中数据属性 Map<String, Map<String, JSONObject>> methodAttrsMap = new HashMap<>();// 属性存储
for (String key : elements.keySet()) {
JSONObject shape1 = elements.getJSONObject(key); Map<String, String> methodValueAttrsMap = new HashMap<>();// 属性存储
if ("linker".equals(shape1.getString("name"))) {
continue; //查询对应绩效模型中数据模型进行填充数据
} BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(id, 0);
String shapeText = shape1.getString("text");
JSONArray dataAttributes = shape1.getJSONArray("dataAttributes"); CoeProcessLevelWeb coeProcessLevelWeb=new CoeProcessLevelWeb(uc);
if (!dataAttributes.isEmpty() && dataAttributes.size() > 0) {
for (Object attribute : dataAttributes) { String define = defineModel.getDefinition();
JSONObject obj = (JSONObject) attribute; JSONObject definition = JSONObject.parseObject(define);
if (obj.containsKey("attributesJsonArray")) { JSONObject elements = definition.getJSONObject("elements");
JSONArray attributesJsonArray = obj.getJSONArray("attributesJsonArray");
for (int i = 0; i < attributesJsonArray.size(); i++) { coeProcessLevelWeb.handleShapeDefaultAttr(wsId, parentModel, elements, methodAttrsMap);
if (attributesJsonArray.getJSONObject(i).containsKey("id")) {
String getid=attributesJsonArray.getJSONObject(i).getString("id"); //拿去流程数据填充绩效模型中数据属性
if(getid.equals("Number_of_the_associated_flow_file")){ for (String key : elements.keySet()) {
attributesJsonArray.getJSONObject(i).put("value", processNumber); 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操作
} }
} catch (AWSDataAccessException e) {
defineModel.setDefinition(definition.toString()); e.printStackTrace();
// 保存文件 } finally {
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// dao操作
} }
} }
@ -599,147 +614,205 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
* 发布流程结束查询关联绩效模型数据插入绩效指标库中 * 发布流程结束查询关联绩效模型数据插入绩效指标库中
* @return * @return
*/ */
public String insertPerformanceIndicatorLibrary(String publishFileId,UserContext uc,String wsId,String processNumber){ public void insertPerformanceIndicatorLibrary(String publishFileId,UserContext uc,String wsId,String processNumber){
//获取关联绩效模型数据 //获取关联绩效模型数据
List performanceList=new ArrayList(); try {
performanceList.add(0,"control.kpi"); List performanceList=new ArrayList();
performanceList.add(1,publishFileId); 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()); 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(), "指标绩效数据插入"); if(performrowMap!=null ){
//拿去流程数据填充绩效模型中数据属性 String id = performrowMap.getString("ID");
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++) { PALRepositoryModel parentModel = PALRepositoryCache.getCache().get(id);
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")){//指标性质 Map<String, Map<String, JSONObject>> methodAttrsMap = new HashMap<>();// 属性存储
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")){//计算公式 Map<String, String> methodValueAttrsMap = new HashMap<>();// 属性存储
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")){//元素 //查询对应绩效模型中数据模型进行填充数据
BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(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(),"");
}
}
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(),"");
} }
SDK.getBOAPI().create("BO_EU_PER_IND_LIB",recordBO,processInst.getId(),"");
} }
} }
} }
} }
} catch (AWSDataAccessException e) {
e.printStackTrace();
} catch (AWSAPIException e) {
e.printStackTrace();
} catch (BPMNError bpmnError) {
bpmnError.printStackTrace();
} finally {
}
}
/**
* 生成MA,MP对应编号
* 生成规则: MP(流程编号是08.01.05.05/P05V1.0-YLYYYY对应的流程绩效编号MP-08.01.05.05-YLYYYY.AA(AA=1~99顺序排号)对流程编号去除"/P05V1.0)
* MA: MA类指标编号半手动编号等于MA.XX.XX.XX.XX.AA其中XX.XX.XX.XX.手动编号最后两位AA系统提供顺序MA下排序
*/
public void createPerformanceNumber(String publishFileId,UserContext uc,String wsId,String processNumber){
//获取流程编号
if(UtilString.isNotEmpty(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());
//MP(流程编号是08.01.05.05/P05V1.0-YLYYYY对应的流程绩效编号MP-08.01.05.05-YLYYYY.AA(AA=1~99顺序排号)对流程编号去除"/P05V1.0)
if(performrowMap!=null){
String before=processNumber.substring(0,processNumber.indexOf("/"));
String after=processNumber.substring(processNumber.indexOf("-"),processNumber.length());
//获取当前MP绩效最新排序数值
DBSql.getMap("");
}
}
} }
//判断模型方法是MA/MP
//处理绩效编号
return "";
}