流程复制的同时复制一个“角色模型”副本
This commit is contained in:
parent
4fda6295e0
commit
1536395f82
@ -2999,7 +2999,7 @@ public class CoEPALController {
|
||||
* @return
|
||||
*/
|
||||
@Mapping("com.actionsoft.apps.coe.pal_pl_repository_designer_relation_shape_createDialogModel")
|
||||
public String createDialogModel(UserContext me,String uuid,String methodId,String wsId,String teamId) {
|
||||
public String createDialogModel(UserContext me,String uuid,String methodId,String wsId,String teamId) {
|
||||
CoeProcessLevelWeb web = new CoeProcessLevelWeb(me);
|
||||
return web.createDialogModel(uuid,methodId,wsId,teamId);
|
||||
}
|
||||
|
||||
@ -1123,25 +1123,34 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
if (palModel == null) {
|
||||
continue;
|
||||
}
|
||||
CoeProcessLevelAutoBean bean = new CoeProcessLevelAutoBean();
|
||||
bean.setName(palModel.getName());
|
||||
bean.setType(palModel.getMethodId());
|
||||
StringBuilder sBuilder = new StringBuilder();// 名称组合
|
||||
StringBuilder idBuilder = new StringBuilder();// Id组合
|
||||
Set<String> idSets = new HashSet<>();// id记录,校验防止递归死循环
|
||||
sBuilder.append(bean.getName());
|
||||
idBuilder.append(palModel.getId());
|
||||
idSets.add(palModel.getId());
|
||||
Map<String, Integer> topLevelmap = new HashMap<String, Integer>();
|
||||
topLevelmap.put("topLevel", palModel.getLevel()); //topLevel:为计算后的顶级目录的级别。没有顶级目录的流程舍去
|
||||
getFilePath(palModel, sBuilder, idBuilder, idSets, topLevelmap);// 递归获取当前文件名称路径
|
||||
if(topLevelmap!=null && topLevelmap.get("topLevel")!=null && topLevelmap.get("topLevel")>1) {
|
||||
continue;
|
||||
|
||||
/****************************过滤已废止数据**by zhaolei*********************/
|
||||
RowMap rowMap=DBSql.getMap("SELECT isStop FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=?",palModel.getId());
|
||||
if(rowMap!=null){
|
||||
String isStop=rowMap.getString("isStop");
|
||||
if(isStop.equals("0")){
|
||||
CoeProcessLevelAutoBean bean = new CoeProcessLevelAutoBean();
|
||||
bean.setName(palModel.getName());
|
||||
bean.setType(palModel.getMethodId());
|
||||
StringBuilder sBuilder = new StringBuilder();// 名称组合
|
||||
StringBuilder idBuilder = new StringBuilder();// Id组合
|
||||
Set<String> idSets = new HashSet<>();// id记录,校验防止递归死循环
|
||||
sBuilder.append(bean.getName());
|
||||
idBuilder.append(palModel.getId());
|
||||
idSets.add(palModel.getId());
|
||||
Map<String, Integer> topLevelmap = new HashMap<String, Integer>();
|
||||
topLevelmap.put("topLevel", palModel.getLevel()); //topLevel:为计算后的顶级目录的级别。没有顶级目录的流程舍去
|
||||
getFilePath(palModel, sBuilder, idBuilder, idSets, topLevelmap);// 递归获取当前文件名称路径
|
||||
if(topLevelmap!=null && topLevelmap.get("topLevel")!=null && topLevelmap.get("topLevel")>1) {
|
||||
continue;
|
||||
}
|
||||
// bean.setUi("<div style='height:100%'>" + sBuilder.toString() + "</div><div style='float:right;height:100%'></div>");
|
||||
bean.setUi(sBuilder.toString());
|
||||
bean.setValue(idBuilder.toString());
|
||||
list.add(bean);
|
||||
}
|
||||
}
|
||||
// bean.setUi("<div style='height:100%'>" + sBuilder.toString() + "</div><div style='float:right;height:100%'></div>");
|
||||
bean.setUi(sBuilder.toString());
|
||||
bean.setValue(idBuilder.toString());
|
||||
list.add(bean);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -690,6 +690,12 @@ public class CoeProcessLevelUtil {
|
||||
propertyModel.setPlId(newUuid);
|
||||
propertyModel.setId(UUIDGener.getUUID());
|
||||
newPropertyList.add(propertyModel);
|
||||
|
||||
//文件属性存在流程绩效,则同步创建关联关系
|
||||
if(propertyModel.getPropertyId().equals("Process_performance_metrics")){
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(newUuid);
|
||||
CoeProcessLevelWeb.createCorrelationDialogModel(newUuid,"control.kpi",model.getWsId(),"");
|
||||
}
|
||||
}
|
||||
}
|
||||
repositoryPropertyDao.batchInsert(newPropertyList);
|
||||
@ -708,11 +714,19 @@ public class CoeProcessLevelUtil {
|
||||
//bybzp 如果图形是过程链图和BPMN图 则不复制流程绩效和角色
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(uuId);
|
||||
String methodId = model.getMethodId();
|
||||
if("process.bpmn2,process.epc".contains(methodId) && "Process_performance_metrics,role".contains(oldModel.getAttrId())){
|
||||
if("process.bpmn2".contains(methodId)){
|
||||
continue;
|
||||
}
|
||||
//by bzp end
|
||||
if (mapNewUUID.containsKey(oldModel.getShapeId())) {
|
||||
|
||||
//如果关联角色图,则同步复制角色图关联关系
|
||||
String methodIds="";
|
||||
if(oldModel.getAttrId().equals("role")){
|
||||
methodIds="org.role";
|
||||
}
|
||||
CoeProcessLevelWeb.createCorrelationDialogModel(model.getId(),methodIds,model.getWsId(),"");
|
||||
|
||||
DesignerShapeRelationModel newModel = new DesignerShapeRelationModel();
|
||||
newModel.setId(UUIDGener.getUUID());
|
||||
newModel.setFileId(uuId);
|
||||
@ -739,8 +753,8 @@ public class CoeProcessLevelUtil {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 更新PAL与BPMS之间的关联(含PAL推送到BPMS运行,BPMS关联到PAL梳理)关系
|
||||
* 由APP_ACT_COE_PROP表数据更新转换至APP_ACT_COE_PAL_CORRELATE
|
||||
|
||||
@ -143,6 +143,8 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
_uc = uc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取未关闭的工作空间
|
||||
*
|
||||
@ -3012,7 +3014,9 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
private int validateJson(Integer index) {
|
||||
return index == null ? 0 : index;
|
||||
}
|
||||
|
||||
private static int validateCorrelationJson(Integer index) {
|
||||
return index == null ? 0 : index;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件属性的扩展属性值修改
|
||||
@ -5306,6 +5310,8 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
ro.put("useId", CoeProcessLevelDaoFacotory.createCoeProcessLevel().getCoeUseProcessLevelByRid(plRid).get(0).getId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void updateDefineShape(PALRepositoryModelImpl newModel, Map<String, String> mapNewUUID, String define) {
|
||||
String messageJson = null;
|
||||
PALRepositoryModel levelModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(newModel.getId());
|
||||
@ -8359,6 +8365,21 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
repositoryPropertyDao.batchInsert(newPropertyList);
|
||||
}
|
||||
|
||||
// 复制文件属性
|
||||
private static void updateCorrelationFileProperty(String oldUuid, String newUuid) {
|
||||
PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao();
|
||||
List<PALRepositoryPropertyModel> oldPropertyList = repositoryPropertyDao.getPropertysByPlid(oldUuid, "");
|
||||
List<PALRepositoryPropertyModel> newPropertyList = new ArrayList<PALRepositoryPropertyModel>();
|
||||
if (oldPropertyList != null && oldPropertyList.size() > 0) {
|
||||
for (PALRepositoryPropertyModel propertyModel : oldPropertyList) {
|
||||
propertyModel.setPlId(newUuid);
|
||||
propertyModel.setId(UUIDGener.getUUID());
|
||||
newPropertyList.add(propertyModel);
|
||||
}
|
||||
}
|
||||
repositoryPropertyDao.batchInsert(newPropertyList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建角色/绩效/表单模型
|
||||
@ -8415,9 +8436,24 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
|
||||
//判断如果methodID为角色图,则创建到对应角色模型文件夹中
|
||||
if(methodId.equals("org.role")){
|
||||
RowMap rowMaprole=DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME='角色模型' and PLCATEGORY='org'");
|
||||
RowMap rowMaprole=DBSql.getMap("SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME='角色模型' and PLCATEGORY='org'");
|
||||
if(rowMaprole!=null){
|
||||
parentId=rowMaprole.getString("ID");
|
||||
}else{
|
||||
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
String roleplRid = UUIDGener.getUUID();
|
||||
String roleid = UUIDGener.getUUID();
|
||||
|
||||
//新建文件夹
|
||||
PALRepositoryModelImpl modeldefault = CoeProcessLevelUtil.createPALRepositoryModel(roleid, roleplRid, wsId, "角色模型",
|
||||
"", 1, "org", "org", true, 1,
|
||||
roleid, false, "default", "0", 1, null,
|
||||
null, "admin", "admin", nowTime, null, null,
|
||||
null, null, null, null, null, null, null, 1);
|
||||
coeProcessLevel.insert(modeldefault);
|
||||
return modeldefault.getId();
|
||||
|
||||
}
|
||||
}
|
||||
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
||||
@ -8528,6 +8564,183 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建角色/绩效/表单模型
|
||||
* @return
|
||||
* by zhaolei
|
||||
*/
|
||||
public static String createCorrelationDialogModel(String uuid,String methodId,String wsId,String teamId){
|
||||
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
try {
|
||||
|
||||
RowMap rowMap = DBSql.getMap("SELECT PLNAME,CREATEUSER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=?", uuid);
|
||||
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("control.kpi")){
|
||||
titleName="绩效图";
|
||||
shapName="kpi";
|
||||
parentId="control";
|
||||
category="control";
|
||||
graphTitle="绩效";
|
||||
}
|
||||
|
||||
|
||||
//先执行新建操作产生plid
|
||||
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||
|
||||
String plRid = UUIDGener.getUUID();
|
||||
String id = UUIDGener.getUUID();
|
||||
|
||||
List data=new ArrayList();
|
||||
data.add(0,methodId);
|
||||
data.add(1,uuid);
|
||||
|
||||
|
||||
|
||||
//判断如果methodID为角色图,则创建到对应角色模型文件夹中
|
||||
if(methodId.equals("org.role")){
|
||||
RowMap rowMaprole=DBSql.getMap("SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME='角色模型' and PLCATEGORY='org'");
|
||||
if(rowMaprole!=null){
|
||||
parentId=rowMaprole.getString("ID");
|
||||
}else{
|
||||
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
String roleplRid = UUIDGener.getUUID();
|
||||
String roleid = UUIDGener.getUUID();
|
||||
|
||||
//新建文件夹
|
||||
PALRepositoryModelImpl modeldefault = CoeProcessLevelUtil.createPALRepositoryModel(roleid, roleplRid, wsId, "角色模型",
|
||||
"", 1, "org", "org", true, 1,
|
||||
roleid, false, "default", "0", 1, null,
|
||||
null, "admin", "admin", nowTime, null, null,
|
||||
null, null, null, null, null, null, null, 1);
|
||||
coeProcessLevel.insert(modeldefault);
|
||||
return modeldefault.getId();
|
||||
|
||||
}
|
||||
}
|
||||
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
||||
PALRepositoryModelImpl model = CoeProcessLevelUtil.createPALRepositoryModel(id, plRid, wsId, plname + titleName,
|
||||
"", 1, parentId, category, true, 1,
|
||||
id, false, methodId, "0", 1, null,
|
||||
null, "admin", "admin", nowTime, null, data.toString(),
|
||||
null, null, null, null, null, null, null, 1);
|
||||
|
||||
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(methodId, shapName);
|
||||
shape.put("id", shapeId);
|
||||
shape.put("text", graphTitle);
|
||||
|
||||
|
||||
JSONArray shapes = new JSONArray();
|
||||
/************************************************数据属性*********************************************************/
|
||||
|
||||
//图形的数据属性配置
|
||||
List<PALMethodAttributeModel> attributeModels = CoeDesignerShapeAPIManager.getInstance().getAllValidShapeAttributeModels(wsId, model.getMethodId());
|
||||
for (PALMethodAttributeModel attributeModel : attributeModels) {
|
||||
|
||||
//todo:根据importProperty的类型获取具体保存数据值
|
||||
|
||||
JSONObject arributeObj = new JSONObject();
|
||||
arributeObj.put("key", attributeModel.getKey());
|
||||
arributeObj.put("isRequired", attributeModel.getIsRequired());
|
||||
arributeObj.put("ref", attributeModel.getRef());
|
||||
arributeObj.put("readonly", attributeModel.getReadonly());
|
||||
arributeObj.put("scope", attributeModel.getScope());
|
||||
arributeObj.put("name", attributeModel.getTitle());
|
||||
arributeObj.put("id", attributeModel.getKey());
|
||||
arributeObj.put("type", attributeModel.getType());
|
||||
arributeObj.put("groupPath", attributeModel.getGroupPath());
|
||||
arributeObj.put("desc", attributeModel.getDesc());
|
||||
arributeObj.put("value", attributeModel.getValue());
|
||||
|
||||
JSONArray dataAttributes = shape.getJSONArray("dataAttributes");
|
||||
if (!dataAttributes.isEmpty() && dataAttributes.size() > 0) {
|
||||
for (Object attribute : dataAttributes) {
|
||||
JSONObject obj = (JSONObject) attribute;
|
||||
if (obj.containsKey("attributesJsonArray")) {
|
||||
obj.getJSONArray("attributesJsonArray").add(arributeObj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/************************************************文件属性*********************************************************/
|
||||
|
||||
|
||||
//复制文件属性
|
||||
updateCorrelationFileProperty(uuid,model.getId());
|
||||
|
||||
shapes.add(shape);
|
||||
JSONArray newShapes = getMethodCorrelationElementsJSONArray(shapes, 1);
|
||||
JSONObject newElements = new JSONObject();
|
||||
for (int i = 0; i < newShapes.size(); i++) {
|
||||
JSONObject shapeObj = newShapes.getJSONObject(i);
|
||||
newElements.put(shapeObj.getString("id"), shapeObj);
|
||||
}
|
||||
|
||||
definition.put("elements", newElements);
|
||||
|
||||
// 设置画布大小
|
||||
DiagramsUtil.setDiagramHeightWidth(definition, newElements);
|
||||
defineModel.setDefinition(definition.toString());
|
||||
// 保存文件
|
||||
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// dao操作
|
||||
|
||||
|
||||
String createuser=rowMap.getString("CREATEUSER");
|
||||
// 小组权限设置
|
||||
if (!UtilString.isEmpty(teamId)) {
|
||||
CoeCooperationAPIManager.getInstance().addRepositoryToTeamAndRolePerm(UserContext.fromUID(createuser), teamId, model.getVersionId(), true, true);
|
||||
}
|
||||
|
||||
ro.put("uuid", id);
|
||||
ro.put("result", "ok");
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
ro.put("result","error");
|
||||
}
|
||||
|
||||
return ro.toString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建具有合理位置的节点数据
|
||||
*
|
||||
@ -8588,6 +8801,66 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建具有合理位置的节点数据
|
||||
*
|
||||
* @param elements
|
||||
* @param shapeRowCount
|
||||
* @return
|
||||
*/
|
||||
private static JSONArray getMethodCorrelationElementsJSONArray(JSONArray elements, int shapeRowCount) {
|
||||
JSONArray result = new JSONArray();
|
||||
int zindex = 0;
|
||||
int initX = 0;
|
||||
int initY = 0;
|
||||
int pageEdge = 100;
|
||||
int count = 0;
|
||||
initX += pageEdge;
|
||||
initY += pageEdge;
|
||||
for (int i = 0; i < elements.size(); i++) {
|
||||
JSONObject shape = elements.getJSONObject(i);
|
||||
count++;
|
||||
if (count % (shapeRowCount + 1) == 0) {
|
||||
count = 1;
|
||||
initY += 130;
|
||||
// 换行
|
||||
initX = 0;
|
||||
initX = pageEdge + initX;
|
||||
}
|
||||
zindex++;
|
||||
if (shape.containsKey("dataAttributes")) {
|
||||
JSONArray dataAttributes = JSONArray.parseArray(shape.getString("dataAttributes"));
|
||||
for (int index = 0; index < dataAttributes.size(); index++) {
|
||||
dataAttributes.getJSONObject(index).put("id", UUIDGener.getObjectId());
|
||||
}
|
||||
shape.put("dataAttributes", dataAttributes);
|
||||
}
|
||||
int totalWidth = 240;// 每个节点总宽度,空白+节点+空白
|
||||
int totalHeight = 200;// 每个节点总高度,空白+节点+空白
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int w = validateCorrelationJson(shape.getJSONObject("props").getInteger("w"));
|
||||
int h = validateCorrelationJson(shape.getJSONObject("props").getInteger("h"));
|
||||
int leftBlankWidth = (totalWidth - w) / 2;
|
||||
int topBlankHeight = (totalHeight - h) / 2;
|
||||
x = initX + leftBlankWidth;
|
||||
initX = x + w + leftBlankWidth;
|
||||
y = initY + topBlankHeight;
|
||||
// y = pageEdge + initY;
|
||||
// if (y < 0) {
|
||||
// y = 100;
|
||||
// }
|
||||
JSONObject props = shape.getJSONObject("props");
|
||||
props.put("x", x);
|
||||
props.put("y", y);
|
||||
props.put("zindex", zindex);
|
||||
shape.put("props", props);
|
||||
result.add(shape);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找关联角色/绩效数据
|
||||
* @param uuid
|
||||
@ -8598,8 +8871,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
List data=new ArrayList();
|
||||
data.add(0,methodId);
|
||||
data.add(1,uuid);
|
||||
System.out.println("data============"+data.toString());
|
||||
System.out.println("methodId============"+methodId);
|
||||
RowMap rowMap=DBSql.getMap("SELECT EXT2 FROM APP_ACT_COE_PAL_REPOSITORY WHERE EXT2=? AND PLMETHODID=?",data.toString(),methodId);
|
||||
if(rowMap!=null){
|
||||
ro.put("result", "ok");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user