绩效模型数据回填

This commit is contained in:
zhal 2022-08-24 21:59:46 +08:00
parent 62a69aa7da
commit f3440c992f
6 changed files with 389 additions and 88 deletions

View File

@ -1053,6 +1053,23 @@ public class CoEPALController {
return web.upFilePortalHtml(pl_uuid, shape_uuid, type);
}
/**
* 获取流程属性信息填充绩效模型
* @param me
* @param params
* @return
*/
@Mapping("com.actionsoft.apps.coe.pal_processlevel_getPerformance")
public String processlevelGetPerformance(UserContext me, RequestParams params) {
String uuid = params.get("fileId");
String methodId = params.get("methodId");
UpfileWeb web = new UpfileWeb(me);
return web.processlevelGetPerformance(uuid,me,methodId);
}
// 上传附件-load
// @Mapping("COE_PAL_PROCESSLEVEL_UPFILE_LOAD")
@Mapping("com.actionsoft.apps.coe.pal_processlevel_upfile_load")

View File

@ -19,12 +19,16 @@ import com.actionsoft.apps.coe.pal.pal.output.dao.OutputTask;
import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel;
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
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.model.DesignerShapeRelationModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel;
import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil;
import com.actionsoft.apps.coe.pal.pal.repository.web.CoeProcessLevelWeb;
import com.actionsoft.apps.coe.pal.util.HighSecurityUtil;
import com.actionsoft.bpms.server.DispatcherRequest;
import com.actionsoft.bpms.server.conf.server.AWSServerConf;
import com.actionsoft.bpms.util.DBSql;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@ -112,6 +116,73 @@ public class UpfileWeb extends ActionWeb {
return HtmlPageTemplate.merge(CoEConstant.APP_ID, "pal.pl.level.upfile.portal.htm", macroLibraries);
}
/***
*
* 获取流程属性信息
* @param uuid
* @param uc
* @param methodId
* @return
*/
public String processlevelGetPerformance(String uuid,UserContext uc,String methodId){
ResponseObject ro = ResponseObject.newOkResponse();
//如果点击跳转绩效模型执行获取来自跳转模型的数据并获取名称
if(methodId.equals("control.kpi")){
PALRepositoryModel palModel = PALRepositoryCache.getCache().get(uuid);
List<String> data=new ArrayList<>();
String ext2=palModel.getExt2();
if(UtilString.isNotEmpty(ext2)){
List<String> datalist=Arrays.asList(ext2.substring(1,ext2.length()-1).split(","));
String parentId=datalist.get(1).toString();
Map<String, Map<String, JSONObject>> methodAttrsMap = new HashMap<>();// 属性存储
Map<String, String> methodValueAttrsMap = new HashMap<>();// 属性存储
PALRepositoryModel parentpalModel = PALRepositoryCache.getCache().get(parentId.trim());
//获取流程文件属性中L1/L2/L3 流程名称流程编号数据用于填充绩效模型数据
PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao();
List<PALRepositoryPropertyModel> oldPropertyList = repositoryPropertyDao.getPropertysByPlid(parentId.trim(), "");
List<PALRepositoryPropertyModel> newPropertyList = new ArrayList<PALRepositoryPropertyModel>();
if (oldPropertyList != null && oldPropertyList.size() > 0) {
for (PALRepositoryPropertyModel propertyModel : oldPropertyList) {
if(propertyModel.getPropertyId().equals("Process_Architecture_L1")){
methodValueAttrsMap.put(propertyModel.getPropertyId(),propertyModel.getPropertyValue());
}
if(propertyModel.getPropertyId().equals("Process_Architecture_L2")){
methodValueAttrsMap.put(propertyModel.getPropertyId(),propertyModel.getPropertyValue());
}
if(propertyModel.getPropertyId().equals("Process_Architecture_L3")){
methodValueAttrsMap.put(propertyModel.getPropertyId(),propertyModel.getPropertyValue());
}
}
}
methodValueAttrsMap.put("Associated_process_name",parentpalModel.getName());
ro.put("methodValueAttrsMap",methodValueAttrsMap);
}
}else{
ro.put("methodValueAttrsMap","");
}
return ro.toString();
}
public String addUpFile(String pl_uuid, String shape_uuid, String type, String download, String fileName,String securityLevel) {
UpfileModel model = new UpfileModel();
UpFileDao dao = new UpFileDao();

View File

@ -8406,6 +8406,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
}
/**
* 创建角色/绩效/表单模型
* @return
@ -8419,7 +8420,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
RowMap rowMap = DBSql.getMap("SELECT PLNAME,PLPARENTID FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=?", uuid);
if (rowMap != null) {
String plname = rowMap.getString("PLNAME");
String plparentid=rowMap.getString("PLPARENTID");
String plparentid=rowMap.getString("PLPARENTID");
String titleName=null;
String shapName=null;
String parentId=null;
@ -8455,8 +8456,8 @@ public class CoeProcessLevelWeb extends ActionWeb {
String id = UUIDGener.getUUID();
List data=new ArrayList();
data.add(0,methodId);
data.add(1,uuid);
data.add(0,methodId.trim());
data.add(1,uuid.trim());
//判断如果methodID为角色图则创建到对应角色模型文件夹中
if(methodId.equals("org.role")){
@ -8501,23 +8502,18 @@ public class CoeProcessLevelWeb extends ActionWeb {
String define = defineModel.getDefinition();
JSONObject definition = JSONObject.parseObject(define);
JSONObject elements = definition.getJSONObject("elements");
Iterator<String> ite = elements.keySet().iterator();
while (ite.hasNext()) {
String key = ite.next();
JSONObject shape = elements.getJSONObject(key);
String name = shape.getString("name");
}
/************************************************文件属性*********************************************************/
//新建一个uuid
String shapeId = UUIDGener.getObjectId();
//拿到基础结构
JSONObject shape = ShapeUtils.getProcessShapeDefinitionByName(methodId, shapName);
shape.put("id", shapeId);
shape.put("text", graphTitle);
JSONArray shapes = new JSONArray();
/************************************************数据属性*********************************************************/
@ -8551,8 +8547,8 @@ public class CoeProcessLevelWeb extends ActionWeb {
}
}
//shape.put("dataAttributes", dataAttributes);
/************************************************文件属性*********************************************************/
//复制文件属性
@ -8566,8 +8562,79 @@ public class CoeProcessLevelWeb extends ActionWeb {
newElements.put(shapeObj.getString("id"), shapeObj);
}
definition.put("elements", newElements);
//如果点击跳转绩效模型执行获取来自跳转模型的数据并获取名称
if(methodId.equals("control.kpi")){
PALRepositoryModel parentModel = PALRepositoryCache.getCache().get(uuid);
Map<String, Map<String, JSONObject>> methodAttrsMap = new HashMap<>();// 属性存储
Map<String, String> methodValueAttrsMap = new HashMap<>();// 属性存储
//获取流程文件属性中L1/L2/L3 流程名称流程编号数据用于填充绩效模型数据
PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao();
List<PALRepositoryPropertyModel> oldPropertyList = repositoryPropertyDao.getPropertysByPlid(id, "");
List<PALRepositoryPropertyModel> newPropertyList = new ArrayList<PALRepositoryPropertyModel>();
if (oldPropertyList != null && oldPropertyList.size() > 0) {
for (PALRepositoryPropertyModel propertyModel : oldPropertyList) {
if(propertyModel.getPropertyId().equals("Process_Architecture_L1")){
methodValueAttrsMap.put(propertyModel.getPropertyId(),propertyModel.getPropertyValue());
}
if(propertyModel.getPropertyId().equals("Process_Architecture_L2")){
methodValueAttrsMap.put(propertyModel.getPropertyId(),propertyModel.getPropertyValue());
}
if(propertyModel.getPropertyId().equals("Process_Architecture_L3")){
methodValueAttrsMap.put(propertyModel.getPropertyId(),propertyModel.getPropertyValue());
}
}
}
methodValueAttrsMap.put("plname",parentModel.getName());
this.handleShapeDefaultAttr(wsId, parentModel, newElements, methodAttrsMap);
for (String key : newElements.keySet()) {
JSONObject shape1 = newElements.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("Process_Architecture_L1")){
attributesJsonArray.getJSONObject(i).put("value", methodValueAttrsMap.get(getid));
}
if(getid.equals("Process_Architecture_L2")){
attributesJsonArray.getJSONObject(i).put("value", methodValueAttrsMap.get(getid));
}
if(getid.equals("Process_Architecture_L3")){
attributesJsonArray.getJSONObject(i).put("value", methodValueAttrsMap.get(getid));
}
if(getid.equals("Associated_process_name")){
attributesJsonArray.getJSONObject(i).put("value", methodValueAttrsMap.get("plname"));
}
}
}
}
}
}
}
}
// 设置画布大小
DiagramsUtil.setDiagramHeightWidth(definition, newElements);
defineModel.setDefinition(definition.toString());
@ -8590,11 +8657,92 @@ public class CoeProcessLevelWeb extends ActionWeb {
return ro.toString();
}
/**
* 自定义属性
* @param wsId
* @param palModel
* @param elements
* @param methodAttrsMap
*/
public void handleShapeDefaultAttr(String wsId, PALRepositoryModel palModel, JSONObject elements, Map<String, Map<String, JSONObject>> methodAttrsMap) {
for (String key : elements.keySet()) {
JSONObject shape = elements.getJSONObject(key);
if ("linker".equals(shape.getString("name"))) {
continue;
}
String shapeMehtodId = shape.getString("category").replace("_", ".");
String shapeName = shape.getString("name");
if (methodAttrsMap.containsKey(palModel.getMethodId()) && methodAttrsMap.containsKey(shapeName)) {
} else {
if (!methodAttrsMap.containsKey(palModel.getMethodId())) {
methodAttrsMap.put(palModel.getMethodId(), new HashMap<>());
}
JSONObject attrs = ShapeUtils.getProcessUseShapeMethodAttrByShapeName(palModel.getWsId(), shapeMehtodId, palModel.getMethodId(), shapeName);
if (attrs != null) {
methodAttrsMap.get(palModel.getMethodId()).put(shapeName, attrs);
}
}
JSONObject attrs = methodAttrsMap.get(palModel.getMethodId()).get(shapeName);// 最终属性内容
attrs = JSONObject.parseObject(attrs.toString());// 复制
JSONArray dataAttributes = shape.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");
Set<String> attrIds = new HashSet<>();
for (int i = 0; i < attributesJsonArray.size(); i++) {
if (attributesJsonArray.getJSONObject(i).containsKey("id")) {
attrIds.add(attributesJsonArray.getJSONObject(i).getString("id"));
}
}
for (String attrId : attrs.keySet()) {
if (!attrIds.contains(attrId)) {
JSONObject eleAttrObj = getDefaultAttrObj(attrs.getJSONObject(attrId));
attributesJsonArray.add(eleAttrObj);
}
}
}
}
}
}
}
/**
* 获取默认属性内容
* @param attr
* @return
*/
private JSONObject getDefaultAttrObj (JSONObject attr) {
String ref = attr.getString("ref");
boolean readonly = attr.getBooleanValue("readonly");
String scope = attr.getString("scope");
String attrName = attr.getString("title");
String attrId = attr.getString("id");
String type = attr.getString("type");
String groupPath = attr.getString("groupPath");
String attrKey = attr.getString("key");
String attrValue = "";
JSONObject object2 = new JSONObject();
object2.put("ref", ref);
object2.put("readonly", readonly);
object2.put("scope", scope);
object2.put("name", attrName);
object2.put("id", attrId);
object2.put("type", type);
object2.put("groupPath", groupPath);
object2.put("key", attrKey);
object2.put("value", "");
return object2;
}

View File

@ -1,74 +1,105 @@
package com.actionsoft.apps.coe.pal.util;
import java.util.ArrayList;
import java.util.List;
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
public class ShapeUtils {
/**
* BPMN图并不全部使用给定范围
*/
private static List<String> bpmnShapeScope() {
List<String> list = new ArrayList<>();
list.add("startEvent");// 开始事件
list.add("messageStartEvent");// 消息开始事件
list.add("timerStartEvent");// 时间开始事件
list.add("signalStartEvent");// 信号开始事件
list.add("userTask");// 人工任务
list.add("serviceTask");// 服务任务
list.add("manualTask");// 手工任务
list.add("scriptTask");// 脚本任务
list.add("inclusiveGateway");// 包容网关
list.add("complexGateway");// 复杂网关
list.add("eventBasedGateway");// 事件网关
list.add("parallelGateway");// 并行网关
list.add("exclusiveGateway");// 排他网关
list.add("timerIntermediateCatchEvent");// 捕获时间事件
list.add("messageIntermediateCatchEvent");// 捕获消息事件
list.add("signalIntermediateCatchEvent");// 捕获信号事件
list.add("messageIntermediateThrowingEvent");// 抛出消息事件
list.add("signalIntermediateThrowingEvent");// 抛出信号事件
list.add("messageBoundaryInterrputingEvent");// 边界消息事件
list.add("signalBoundaryInterrputingEvent");// 边界信号事件
list.add("errorBoundaryInterrputingEvent");// 边界错误事件
list.add("endEvent");// 结束事件
list.add("terminateEndEvent");// 终止事件
list.add("messageEndEvent");// 消息结束事件
list.add("signalEndEvent");// 信号结束事件
list.add("errorEndEvent");// 错误结束事件
list.add("callActivityCallingProcess");// 调用子流程
list.add("group");//
// list.add("textAnnotation");// 注释
return list;
}
/**
* 获取流程节点定义
* @param methodId 类型
* @param shapeName 节点类型
* @return
*/
public static JSONObject getProcessShapeDefinitionByName(String methodId, String shapeName) {
JSONArray shapes = CoeDesignerUtil.getShapeDefinition(methodId);
for (Object shape : shapes) {
JSONObject shapeObj = (JSONObject) shape;
if (shapeObj.containsKey("name")) {
String name = shapeObj.getString("name");
if (methodId.contains("bpmn")) {
if (bpmnShapeScope().contains(shapeObj.getString("name")) && name.equals(shapeName)) {
return shapeObj;
}
} else {
if (name.equals(shapeName)) {
return shapeObj;
}
}
}
}
return null;
}
}
package com.actionsoft.apps.coe.pal.util;
import java.util.ArrayList;
import java.util.List;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodAttributeModel;
import com.actionsoft.apps.coe.pal.pal.repository.designer.CoeDesignerShapeAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
public class ShapeUtils {
/**
* BPMN图并不全部使用给定范围
*/
private static List<String> bpmnShapeScope() {
List<String> list = new ArrayList<>();
list.add("startEvent");// 开始事件
list.add("messageStartEvent");// 消息开始事件
list.add("timerStartEvent");// 时间开始事件
list.add("signalStartEvent");// 信号开始事件
list.add("userTask");// 人工任务
list.add("serviceTask");// 服务任务
list.add("manualTask");// 手工任务
list.add("scriptTask");// 脚本任务
list.add("inclusiveGateway");// 包容网关
list.add("complexGateway");// 复杂网关
list.add("eventBasedGateway");// 事件网关
list.add("parallelGateway");// 并行网关
list.add("exclusiveGateway");// 排他网关
list.add("timerIntermediateCatchEvent");// 捕获时间事件
list.add("messageIntermediateCatchEvent");// 捕获消息事件
list.add("signalIntermediateCatchEvent");// 捕获信号事件
list.add("messageIntermediateThrowingEvent");// 抛出消息事件
list.add("signalIntermediateThrowingEvent");// 抛出信号事件
list.add("messageBoundaryInterrputingEvent");// 边界消息事件
list.add("signalBoundaryInterrputingEvent");// 边界信号事件
list.add("errorBoundaryInterrputingEvent");// 边界错误事件
list.add("endEvent");// 结束事件
list.add("terminateEndEvent");// 终止事件
list.add("messageEndEvent");// 消息结束事件
list.add("signalEndEvent");// 信号结束事件
list.add("errorEndEvent");// 错误结束事件
list.add("callActivityCallingProcess");// 调用子流程
list.add("group");//
// list.add("textAnnotation");// 注释
return list;
}
/**
* 获取流程节点定义
* @param methodId 类型
* @param shapeName 节点类型
* @return
*/
public static JSONObject getProcessShapeDefinitionByName(String methodId, String shapeName) {
JSONArray shapes = CoeDesignerUtil.getShapeDefinition(methodId);
for (Object shape : shapes) {
JSONObject shapeObj = (JSONObject) shape;
if (shapeObj.containsKey("name")) {
String name = shapeObj.getString("name");
if (methodId.contains("bpmn")) {
if (bpmnShapeScope().contains(shapeObj.getString("name")) && name.equals(shapeName)) {
return shapeObj;
}
} else {
if (name.equals(shapeName)) {
return shapeObj;
}
}
}
}
return null;
}
/**
* 具体流程类别下的扩展属性列表
* @param methodId
* @return
*/
public static JSONObject getProcessUseShapeMethodAttrByShapeName(String wsId, String shapeMethod, String methodId, String shapeName) {
JSONObject result = new JSONObject();
List<PALMethodAttributeModel> attributeModelList = CoeDesignerShapeAPIManager.getInstance().getValidAndUseAttributeModels(wsId, shapeMethod, shapeName, methodId);
for (PALMethodAttributeModel attributeModel : attributeModelList) {
String scope = attributeModel.getScope();
if (scope.contains("*") || "*".equals(scope) || scope.contains(shapeName)) {
JSONObject obj = new JSONObject();
obj.put("readonly", attributeModel.getReadonly());
obj.put("id", attributeModel.getKey());
obj.put("key", attributeModel.getKey());
obj.put("scope", attributeModel.getScope());
obj.put("name", attributeModel.getTitle());
obj.put("title", attributeModel.getNewTitle());
obj.put("type", attributeModel.getType());
obj.put("ref", attributeModel.getRef());
obj.put("groupPath", attributeModel.getGroupPath());
result.put(attributeModel.getKey(), obj);
}
}
return result;
}
}

View File

@ -351,8 +351,43 @@ Model.create = function(l, h, j) {
var i = o.dataAttributes[k];
i.id = Utils.newId();
if (i.attributesJsonArray) {
//判断如果为流程跳转绩效模型,填充相应数据
var propertyInfoArray= new Array();
$.ajax({
type : "POST",
async : false,
url : "./jd?sid="
+ CLB.sid
+ "&cmd=com.actionsoft.apps.coe.pal_processlevel_getPerformance",
data : {
fileId : ruuid,
methodId: methodId
},
success : function(msg) {
if (msg.result == "ok") {
if(msg.data.methodValueAttrsMap!=''){
propertyInfoArray.push(msg.data.methodValueAttrsMap);
}
}
}
});
if (Model.define.localAttribute != undefined && Model.define.localAttribute[o.name] != undefined && Model.define.localAttribute[o.name] != null && Model.define.localAttribute[o.name].length > 0) {
for (var n in Model.define.localAttribute[o.name]) {
if(propertyInfoArray.length>0){
if(Model.define.localAttribute[o.name][n].id=='Process_Architecture_L1'){
Model.define.localAttribute[o.name][n].value=propertyInfoArray[0].Process_Architecture_L1;
}
if(Model.define.localAttribute[o.name][n].id=='Process_Architecture_L2'){
Model.define.localAttribute[o.name][n].value=propertyInfoArray[0].Process_Architecture_L2;
}
if(Model.define.localAttribute[o.name][n].id=='Process_Architecture_L3'){
Model.define.localAttribute[o.name][n].value=propertyInfoArray[0].Process_Architecture_L3;
}
if(Model.define.localAttribute[o.name][n].id=='Associated_process_name'){
Model.define.localAttribute[o.name][n].value=propertyInfoArray[0].Associated_process_name;
}
}
i.attributesJsonArray.push(Utils.copy(Model.define.localAttribute[o.name][n]));
}
}
@ -810,7 +845,6 @@ function operateAwsorgDB(shapesObj, shapeId, shapeText, attrId, shapeAttrJson) {
getPrivateAttributeHtml(tmpAttributesJsonArray, "tagContentTable0", tmpShape);
}
function operateDB(shapesObj, shapeId, attrId, shapeAttrJson) {
debugger;
//添加关联属性时更新relationShapeModelObject的值
var tmp = shapeId + '_' + attrId;
relationShapeModelObject[tmp] = [];