角色模型跳转

This commit is contained in:
zhal 2022-07-01 15:04:56 +08:00
parent e48427728a
commit 4e82f54c98
5 changed files with 168 additions and 120 deletions

View File

@ -0,0 +1,94 @@
package com.actionsoft.apps.coe.pal.datamigration.util.readword;
/**
* @author baizp
* @Description:
* @date 2022/6/21 17:21
*/
import java.io.IOException;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.xmlbeans.*;
import org.openxmlformats.schemas.drawingml.x2006.main.*;
import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTInline;
/**
* [ref] https://issues.apache.org/bugzilla/show_bug.cgi?id=49765
* [ref] http://pastebin.com/index/CbQ3iw8t, http://pastebin.com/2YAneYgt
*/
public class CustomXWPFDocument extends XWPFDocument
{
public CustomXWPFDocument() throws IOException
{
super();
}
public void createPictureCxCy(String blipId,int id, long cx, long cy)
{
CTInline inline = createParagraph().createRun().getCTR().addNewDrawing().addNewInline();
String picXml = "" +
"<a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">" +
" <a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">" +
" <pic:pic xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">" +
" <pic:nvPicPr>" +
" <pic:cNvPr id=\"" + id + "\" name=\"Generated\"/>" +
" <pic:cNvPicPr/>" +
" </pic:nvPicPr>" +
" <pic:blipFill>" +
" <a:blip r:embed=\"" + blipId + "\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"/>" +
" <a:stretch>" +
" <a:fillRect/>" +
" </a:stretch>" +
" </pic:blipFill>" +
" <pic:spPr>" +
" <a:xfrm>" +
" <a:off x=\"0\" y=\"0\"/>" +
" <a:ext cx=\"" + cx + "\" cy=\"" + cy + "\"/>" +
" </a:xfrm>" +
" <a:prstGeom prst=\"rect\">" +
" <a:avLst/>" +
" </a:prstGeom>" +
" </pic:spPr>" +
" </pic:pic>" +
" </a:graphicData>" +
"</a:graphic>";
//CTGraphicalObjectData graphicData = inline.addNewGraphic().addNewGraphicData();
XmlToken xmlToken = null;
try
{
xmlToken = XmlToken.Factory.parse(picXml);
}
catch(XmlException xe)
{
xe.printStackTrace();
}
inline.set(xmlToken);
//graphicData.set(xmlToken);
inline.setDistT(0);
inline.setDistB(0);
inline.setDistL(0);
inline.setDistR(0);
CTPositiveSize2D extent = inline.addNewExtent();
extent.setCx(cx);
extent.setCy(cy);
CTNonVisualDrawingProps docPr = inline.addNewDocPr();
docPr.setId(id);
docPr.setName("Picture " + id);
docPr.setDescr("Generated");
}
public void createPicture(String blipId,int id, int width, int height)
{
final int EMU = 9525;
width *= EMU;
height *= EMU;
//String blipId = getAllPictures().get(id).getPackageRelationship().getId();
createPictureCxCy(blipId, id, width, height);
}
}

View File

@ -760,7 +760,7 @@ public class DesignerRelationShapeWeb extends ActionWeb {
JSONArray jsonArr_new= new JSONArray();
JSONArray objects=JSONArray.parseArray(treeJson);
//角色图属性代码是role/绩效图属性代码是
if (attrId.equals("role") || attrId.equals("performance")) {
if (attrId.equals("role") || attrId.equals("Process_performance_metrics")) {
if (objects != null) {
for (int i = 0; i < objects.size(); i++) {
JSONObject jsonObject = objects.getJSONObject(i);

View File

@ -5,7 +5,7 @@ import com.actionsoft.apps.AppsConst;
import com.actionsoft.apps.coe.pal.cooperation.CoeCooperationAPIManager;
import com.actionsoft.apps.coe.pal.log.CoEOpLogAPI;
import com.actionsoft.apps.coe.pal.log.CoEOpLogConst;
import com.actionsoft.apps.coe.pal.pal.repository.util.DiagramUtil;
import com.actionsoft.apps.coe.pal.pal.repository.util.DiagramsUtil;
import com.actionsoft.apps.coe.pal.pal.repository.util.ShapeUtils;
import com.actionsoft.apps.coe.pal.pal.ws.constant.CoeWsConstant;
import com.actionsoft.apps.coe.pal.util.HighSecurityUtil;
@ -8052,6 +8052,9 @@ public class CoeProcessLevelWeb extends ActionWeb {
return ro.toString();
}
/**
* 根据用户选择类型创建相应制度图形
* @param type
@ -8080,7 +8083,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
//新建一个uuid
String shapeId = UUIDGener.getObjectId();
//拿到基础结构
//拿到基础结构
JSONObject shape;
if(type.equals("1")){
shape=ShapeUtils.getProcessShapeDefinitionByName("control_policy", "regulation");
@ -8106,7 +8109,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
elements.put(shapeId, shape);
// 设置画布大小
DiagramUtil.setDiagramHeightWidth(definition, elements);
DiagramsUtil.setDiagramHeightWidth(definition, elements);
defineModel.setDefinition(definition.toString());
// 保存文件
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// dao操作
@ -8121,7 +8124,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
}
/**
* 创建角色
* 创建角色/绩效/表单模型
* @return
* by zhaolei
*/
@ -8134,20 +8137,44 @@ public class CoeProcessLevelWeb extends ActionWeb {
if (rowMap != null) {
String plname = rowMap.getString("PLNAME");
String titleName=null;
String shapName=null;
String parentId=null;
String category=null;
String graphTitle=null;
if(methodId.equals("org.role")){
titleName="角色图";
shapName="role";
parentId="org";
category="org";
graphTitle="角色";
}else if(methodId.equals("process")){
titleName="表单图";
shapName="form";
parentId="data";
category="data";
methodId="data.form";
graphTitle="表单";
}else if(methodId.equals("control.kpi")){
titleName="绩效图";
shapName="kpi";
parentId="control";
category="control";
graphTitle="绩效";
}
//先执行新建操作产生plid
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
String plRid = UUIDGener.getUUID();
String id = UUIDGener.getUUID();
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);
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
PALRepositoryModelImpl model = CoeProcessLevelUtil.createPALRepositoryModel(id, plRid, "6f4e292c-1b90-4dd2-8c20-7da159cb20a5", plname + titleName,
"", 1, parentId, category, true, 1,
id, false, methodId, "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);
@ -8166,11 +8193,10 @@ public class CoeProcessLevelWeb extends ActionWeb {
//新建一个uuid
String shapeId = UUIDGener.getObjectId();
//拿到基础结构
JSONObject shape = ShapeUtils.getProcessShapeDefinitionByName(methodId, "role");
JSONObject shape = ShapeUtils.getProcessShapeDefinitionByName(methodId, shapName);
shape.put("id", shapeId);
shape.put("text", "角色");
shape.put("text", graphTitle);
JSONObject props = shape.getJSONObject("props");// 位置大小
props.put("zindex", 0);
@ -8182,7 +8208,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
elements.put(shapeId, shape);
// 设置画布大小
DiagramUtil.setDiagramHeightWidth(definition, elements);
DiagramsUtil.setDiagramHeightWidth(definition, elements);
defineModel.setDefinition(definition.toString());
// 保存文件
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// dao操作
@ -8200,85 +8226,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
}
/**
* 创建角色图
* @return
* by zhaolei
*/
public String createFormDialogModel(String uuid,String method,String category){
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");
//先执行新建操作产生plid
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
String plRid = UUIDGener.getUUID();
String id = UUIDGener.getUUID();
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
PALRepositoryModelImpl model = CoeProcessLevelUtil.createPALRepositoryModel(id, plRid, "6f4e292c-1b90-4dd2-8c20-7da159cb20a5", plname + "表单图",
"", 1, "data", "data", true, 1,
id, false, "data.form", "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);
BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(model.getId(), 0);
if (defineModel == null) {
defineModel = CoeDesignerUtil.createModel(model.getId(), 0);
defineModel.setCreateHistory(false);
}
String define = defineModel.getDefinition();
JSONObject definition = JSONObject.parseObject(define);
JSONObject elements = definition.getJSONObject("elements");
//新建一个uuid
String shapeId = UUIDGener.getObjectId();
//拿到基础结构
JSONObject shape = ShapeUtils.getProcessShapeDefinitionByName("data.form", "form");
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");
}
} catch (NumberFormatException e) {
e.printStackTrace();
ro.put("result","error");
}
return ro.toString();
}
/**
* 查找关联角色/绩效数据
* @param uuid

View File

@ -966,14 +966,21 @@ function removeTr(obj) {
//打开对象关联Dialog
function openRelationDialog(obj, callback) {
debugger;
debugger;
var title = obj.closest('tr').find('td:first').text();
if (title == undefined || title == '') {
title = '选择模型对象';
}
var ref = obj.attr('ref');// 存储关联范围配置
var method=JSON.parse(ref).method;
if(method=="process" ){
var methodName="";
if(method=="process"){
methodName="新建表单模型";
}else if(method=="control.kpi"){
methodName="新建绩效模型";
}
if(method=="process" || method=="control.kpi"){
var relationDlg = parent.FrmDialog.open({
title: title,
width:710,
@ -1001,31 +1008,31 @@ function openRelationDialog(obj, callback) {
document.getElementById("id-awsui-win-frm-2013-frmrelationDialog").contentWindow.location.reload(true);
}
},{
text : "新建表单模型",
cls : "green",
handler : function() {
//跳转角色/绩效图形,并新增角色/绩效图形
$.ajax({
type : "POST",
url : "./jd?sid="
+ $("#sid").val()
+ "&cmd=com.actionsoft.apps.coe.pal_pl_repository_designer_relation_shape_createFormDialogModel",
data : {
uuid:uuid,
method: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 : methodName,
cls : "green",
handler : function() {
//跳转表单/绩效模型
$.ajax({
type : "POST",
url : "./jd?sid="
+ $("#sid").val()
+ "&cmd=com.actionsoft.apps.coe.pal_pl_repository_designer_relation_shape_createDialogModel",
data : {
uuid:uuid,
methodId: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 attrId = obj.attr("id");
var relationFileId = "";