角色图关联

This commit is contained in:
zhal 2022-06-29 10:14:24 +08:00
parent d23715be50
commit cf15086ced
5 changed files with 242 additions and 68 deletions

View File

@ -2921,7 +2921,7 @@ public class CoEPALController {
/**
* 弹窗新建角色图形创建相应图形
* @param me
* @param relationShapeList
* @param
* @return
*/
@Mapping("com.actionsoft.apps.coe.pal_pl_repository_designer_relation_shape_createRole")
@ -2930,6 +2930,22 @@ public class CoEPALController {
return web.RelationShapeCreateRole(uuid,methodId);
}
/**
* 查询是否有相同角色图数据
* @param me
* @param
* @return
*/
@Mapping("com.actionsoft.apps.coe.pal_pl_repository_designer_relation_find_same_role")
public String relationFindSameRole(UserContext me,String uuid) {
CoeProcessLevelWeb web = new CoeProcessLevelWeb(me);
return web.relationFindSameRole(uuid);
}
/**
* 获取最近编辑的文件和收藏的文件
* @param me

View File

@ -19,9 +19,11 @@ 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.relation.manager.DesignerShapeCopyCache;
import com.actionsoft.apps.coe.pal.pal.repository.web.CoeProcessLevelWeb;
import com.actionsoft.apps.coe.pal.system.util.StringUtil;
import com.actionsoft.apps.coe.pal.util.BpmOrgUtil;
import com.actionsoft.apps.coe.pal.util.HighSecurityUtil;
import com.actionsoft.bpms.commons.cache.Cache;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
@ -751,7 +753,38 @@ public class DesignerRelationShapeWeb extends ActionWeb {
String type = refObj.getString("type");// 关联类型 file shape
// macroLibraries.put("treeData", getTreeJson(wsId, "", category, type, method));
// by bzp
macroLibraries.put("treeData", getTreeJson(wsId, "", category, type, method,ruuid));
//根据传入uuid,进行过滤保留当前流程的数据
JSONArray newRelationShapeList = new JSONArray();
String treeJson=getTreeJson(wsId, "", category, type, method,ruuid);
//JSONObject jsonObject = JSONObject.parseObject(json);
JSONArray jsonArr_new= new JSONArray();
JSONArray objects=JSONArray.parseArray(treeJson);
if (objects!=null) {
for (int i=0;i<objects.size();i++) {
JSONObject jsonObject = objects.getJSONObject(i);
String url=jsonObject.getString("url");
String id=jsonObject.getString("id");
String open=jsonObject.getString("open");
if(open!=null){
jsonArr_new.add(objects.getJSONObject(i));
}
if(UtilString.isNotEmpty(url)){
String spiltUuid = url.substring(url.lastIndexOf("&uuid=")+6);
RowMap rowMap=DBSql.getMap("SELECT EXT2 FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=? AND EXT2=?",id,ruuid);
if(rowMap!=null){
jsonArr_new.add(objects.getJSONObject(i));
}
}
}
}
macroLibraries.put("treeData", jsonArr_new.toString());
//macroLibraries.put("treeData", getTreeJson(wsId, "", category, type, method,ruuid));
macroLibraries.put("sid", _uc.getSessionId());
macroLibraries.put("wsid", wsId);
macroLibraries.put("attrId", attrId);
@ -805,6 +838,8 @@ public class DesignerRelationShapeWeb extends ActionWeb {
}
}
}
macroLibraries.put("relationShapeList", relationShapeList);
return HtmlPageTemplate.merge(CoEConstant.APP_ID, "pal.pl.repository.designer.shapes.htm", macroLibraries);
}

View File

@ -8127,7 +8127,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
return ro.toString();
}
/**
/**
* 创建角色图
* @return
*/
@ -8136,78 +8136,76 @@ public class CoeProcessLevelWeb extends ActionWeb {
ResponseObject ro = ResponseObject.newOkResponse();
try {
RowMap rowMap = DBSql.getMap("SELECT PLNAME FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=?", uuid);
if (rowMap != null) {
String plname = rowMap.getString("PLNAME");
String plcategory = rowMap.getString("PLCATEGORY");
RowMap rowMap = DBSql.getMap("SELECT PLNAME FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=?", uuid);
if (rowMap != null) {
String plname = rowMap.getString("PLNAME");
Map<String, String> idRelationMap = new HashMap<>();
//先执行新建操作产生plid
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
String plRid = UUIDGener.getUUID();
String id = UUIDGener.getUUID();
String parentId = "org";
String parentVersionId = "";
int level = 1;
if (parentId.length() < 36) {// 父节点是大类
parentVersionId = parentId;
} else {
PALRepositoryModel parentModel = PALRepositoryCache.getCache().get(parentId);
parentVersionId = parentModel.getVersionId();
level = parentModel.getLevel() + 1;
}
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
PALRepositoryModelImpl model = CoeProcessLevelUtil.createPALRepositoryModel(id, plRid, "6f4e292c-1b90-4dd2-8c20-7da159cb20a5", plname + "-角色图",
"", 1, "org", "org", true, 1,
id, false, "org.role", "0", 1, null,
null, "admin", "admin", nowTime, null, uuid,
null, null, null, null, null, null, null, 1);
System.out.println(model.getId());
coeProcessLevel.insert(model);
Map<String, String> idRelationMap = new HashMap<>();
//先执行新建操作产生plid
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(model.getId(), 0);
if (defineModel == null) {
defineModel = CoeDesignerUtil.createModel(model.getId(), 0);
defineModel.setCreateHistory(false);
}
String plRid = UUIDGener.getUUID();
String id = UUIDGener.getUUID();
String define = defineModel.getDefinition();
JSONObject definition = JSONObject.parseObject(define);
JSONObject elements = definition.getJSONObject("elements");
String parentId = "org";
String parentVersionId = "";
int level = 1;
if (parentId.length() < 36) {// 父节点是大类
parentVersionId = parentId;
} else {
PALRepositoryModel parentModel = PALRepositoryCache.getCache().get(parentId);
parentVersionId = parentModel.getVersionId();
level = parentModel.getLevel() + 1;
}
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
PALRepositoryModelImpl model = CoeProcessLevelUtil.createPALRepositoryModel(id, plRid, "6f4e292c-1b90-4dd2-8c20-7da159cb20a5", plname + "-角色图",
"", 1, "org", "org", true, 1,
id, false, "org.role", "0", 1, null,
null, "admin", "admin", nowTime, null, null,
null, null, null, null, null, null, null, 1);
System.out.println(model.getId());
coeProcessLevel.insert(model);
//新建一个uuid
String shapeId = UUIDGener.getObjectId();
BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(model.getId(), 0);
if (defineModel == null) {
defineModel = CoeDesignerUtil.createModel(model.getId(), 0);
defineModel.setCreateHistory(false);
}
//拿到基础结构
JSONObject shape = ShapeUtils.getProcessShapeDefinitionByName("org.role", "role");
shape.put("id", shapeId);
shape.put("text", "角色");
String define = defineModel.getDefinition();
JSONObject definition = JSONObject.parseObject(define);
JSONObject elements = definition.getJSONObject("elements");
JSONObject props = shape.getJSONObject("props");// 位置大小
props.put("zindex", 0);
props.put("x", Integer.parseInt("400"));
props.put("y", Integer.parseInt("106"));
props.put("w", Integer.parseInt("110"));
props.put("h", Integer.parseInt("50"));
props.put("zindex", 1);
elements.put(shapeId, shape);
//新建一个uuid
String shapeId = UUIDGener.getObjectId();
// 设置画布大小
DiagramUtil.setDiagramHeightWidth(definition, elements);
defineModel.setDefinition(definition.toString());
// 保存文件
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// dao操作
//拿到基础结构
JSONObject shape = ShapeUtils.getProcessShapeDefinitionByName("org.role", "role");
shape.put("id", shapeId);
shape.put("text", "角色");
JSONObject props = shape.getJSONObject("props");// 位置大小
props.put("zindex", 0);
props.put("x", Integer.parseInt("400"));
props.put("y", Integer.parseInt("106"));
props.put("w", Integer.parseInt("110"));
props.put("h", Integer.parseInt("50"));
props.put("zindex", 1);
elements.put(shapeId, shape);
// 设置画布大小
DiagramUtil.setDiagramHeightWidth(definition, elements);
defineModel.setDefinition(definition.toString());
// 保存文件
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// dao操作
ro.put("uuid", id);
ro.put("result", "ok");
}
ro.put("uuid", id);
ro.put("result", "ok");
}
} catch (NumberFormatException e) {
e.printStackTrace();
ro.put("result","error");
@ -8217,6 +8215,17 @@ public class CoeProcessLevelWeb extends ActionWeb {
}
public String relationFindSameRole(String uuid){
ResponseObject ro = ResponseObject.newOkResponse();
RowMap rowMap=DBSql.getMap("SELECT EXT2 FROM APP_ACT_COE_PAL_REPOSITORY WHERE EXT2=?",uuid);
if(rowMap!=null){
ro.put("result", "ok");
}else{
ro.put("result","error");
}
return ro.toString();
}
/**
* 获取最近的文件和收藏的文件

View File

@ -419,11 +419,13 @@ function writeRelationListHtml() {
$("#relationShapes").empty();
var html = "";
for (var i = 0; i < relationShapeList.length; i++) {
var url="./w?uuid=" + relationShapeList[i].relationFileId+"&teamId"
+ "&cmd=com.actionsoft.apps.coe.pal_pl_repository_designer&sid=" + encodeURIComponent($('#sid').val())
var relationShapeText = relationShapeList[i].relationShapeText;
relationShapeText = relationShapeText.replace("<", "&lt;").replace(">", "&gt;").replace("\"", "&quot;");
html += "<li>"
+ " <div class=\"relation_div\" index=\"" + i + "\">"
+ " <div class='text-overflow' fileId=\"" + relationShapeList[i].relationFileId + "\" shapeId=\"" + relationShapeList[i].relationShapeId + "\">" + relationShapeText + "</div>"
+ " <div class='text-overflow' fileId=\"" + relationShapeList[i].relationFileId + "\" shapeId=\"" + relationShapeList[i].relationShapeId + "\" onclick=\"window.open('"+url+"')\">" + relationShapeText + "</div>"
+ " <img src=\"../apps/com.actionsoft.apps.coe.pal/lib/designer/extend/images/close_attr.jpg\" style=\"cursor: pointer; display: none;\"/>"
+ " </div>"
+ "</li>";

View File

@ -3434,7 +3434,7 @@ function openRelationDig(obj,value) {
+ "&relationShapeIds=" + relationShapeIds
+ "&relationFileIds=" + relationFileIds
+ "&ruuid=" + ruuid);
$("#attr_dialog_normal_relevance_shapes_div").dialog({
/*$("#attr_dialog_normal_relevance_shapes_div").dialog({
buttons : [{
text : '确定',
cls : "blue",
@ -3461,6 +3461,118 @@ function openRelationDig(obj,value) {
$("#attr_dialog_normal_relevance_shapes_div").dialog('close');
}
}]
});*/
//跳转角色图形,并新增角色图形
$.ajax({
type : "POST",
url : "./jd?sid="
+ CLB.sid
+ "&cmd=com.actionsoft.apps.coe.pal_pl_repository_designer_relation_find_same_role",
data : {
uuid:ruuid
},
success : function(msg) {
debugger;
if (msg.data.result == "ok") {
$("#attr_dialog_normal_relevance_shapes_div").dialog({
buttons : [
{
text : '确定',
cls : "blue",
handler : function() {
var tmpObjId = $(obj).attr("objid");
getRelevanceShapes(tmpObjId,value);
var tmpShape = Utils.getSelected()[0];
var tmpTitle = tmpShape.title;
if (tmpShape.name == "linker") {
return;
}
if (tmpTitle.indexOf("泳道") > -1 || tmpTitle.indexOf("泳池") > -1 || tmpTitle.indexOf("分隔") > -1) {
return;
}
if (isForceShowError && tmpAttrIdValue.indexOf(tmpObjId) > -1) {
$.simpleAlert("已设置不允许修改,请在应用参数中设置", 'error');
isForceShowError = false;
}
tmpAttrIdValue = [];
}
}, {
text : '关闭',
handler : function() {
$("#attr_dialog_normal_relevance_shapes_div").dialog('close');
}
}]
});
}else{
$("#attr_dialog_normal_relevance_shapes_div").dialog({
buttons : [
{
text : '刷新',
cls : "green",
handler : function() {
// 刷新页面
//initLayout();
}
},{
text : '新建角色模型',
cls : "green",
handler : function() {
//跳转角色图形,并新增角色图形
$.ajax({
type : "POST",
url : "./jd?sid="
+ CLB.sid
+ "&cmd=com.actionsoft.apps.coe.pal_pl_repository_designer_relation_shape_createRole",
data : {
uuid:ruuid,
methodId:JSON.parse(ref).method
},
success : function(msg) {
if (msg.result == "ok") {
window.open("./w?uuid=" + msg.data.uuid+"&teamId"
+ "&cmd=com.actionsoft.apps.coe.pal_pl_repository_designer&sid=" + encodeURIComponent($('#sid').val()));
}
}
});
}
}, {
text : '确定',
cls : "blue",
handler : function() {
var tmpObjId = $(obj).attr("objid");
getRelevanceShapes(tmpObjId,value);
var tmpShape = Utils.getSelected()[0];
var tmpTitle = tmpShape.title;
if (tmpShape.name == "linker") {
return;
}
if (tmpTitle.indexOf("泳道") > -1 || tmpTitle.indexOf("泳池") > -1 || tmpTitle.indexOf("分隔") > -1) {
return;
}
if (isForceShowError && tmpAttrIdValue.indexOf(tmpObjId) > -1) {
$.simpleAlert("已设置不允许修改,请在应用参数中设置", 'error');
isForceShowError = false;
}
tmpAttrIdValue = [];
}
}, {
text : '关闭',
handler : function() {
$("#attr_dialog_normal_relevance_shapes_div").dialog('close');
}
}]
});
}
}
});
}