Merge branch 'apps_dev_ydq_sjdb' into apps_4_test

This commit is contained in:
袁东强 2025-07-14 14:28:13 +08:00
commit 35cf0acd2e
52 changed files with 6294 additions and 11 deletions

View File

@ -0,0 +1,44 @@
package com.actionsoft.apps.coe.pal;
import com.actionsoft.apps.coe.pal.pal.repository.designer.dto.VersionCompareDTO;
import com.actionsoft.apps.coe.pal.pal.repository.designer.dto.VersionListDTO;
import com.actionsoft.apps.coe.pal.pal.repository.designer.web.CoeDesignerVersionWeb;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.bind.annotation.Controller;
import com.actionsoft.bpms.server.bind.annotation.Mapping;
/**
* @author oYang
* @Description 设计器-流程版本对比 控制类
* @createTime 2024年07月29日 11:04:00
*/
@Controller
public class CoEDesignerVersionController {
/**
* 设计器版本列表
*
* @param uc 用户上下文
* @param wsId 资产库Id
* @param teamId 小组Id
* @param id 模型Id
* @return 模型版本列表
*/
@Mapping("com.actionsoft.apps.coe.pal_pl_repository_designer_version_list")
public String designerVersionList(UserContext uc, String wsId, String teamId, String id) {
VersionListDTO versionListDTO = new VersionListDTO(wsId, teamId, id);
return new CoeDesignerVersionWeb(uc).getVersionList(versionListDTO);
}
/**
* 设计器版本对比
*
* @param uc 用户上下文
* @param wsId 资产库Id
* @return 模型版本对比页面
*/
@Mapping("com.actionsoft.apps.coe.pal_pl_repository_designer_version_compare")
public String designerVersionCompare(UserContext uc, String wsId, String teamId, String compareVerId, String curId) {
VersionCompareDTO versionCompareDTO = new VersionCompareDTO(wsId, teamId, compareVerId, curId);
return new CoeDesignerVersionWeb(uc).designerVersionCompare(versionCompareDTO);
}
}

View File

@ -0,0 +1,56 @@
package com.actionsoft.apps.coe.pal.components.model;
/**
* 密级实体类
*/
public class PALSecurityLevelModel {
/**
* 密级code
*/
private String code;
/**
* 密级名称
*/
private String name;
/**
* 密级颜色
*/
private String color;
public PALSecurityLevelModel() {
}
public PALSecurityLevelModel(String code, String name, String color) {
this.code = code;
this.name = name;
this.color = color;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
}

View File

@ -0,0 +1,133 @@
package com.actionsoft.apps.coe.pal.pal.method.cache;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import com.actionsoft.apps.coe.pal.pal.method.cache.index.PALBasicMethodCacheIndex1;
import com.actionsoft.apps.coe.pal.pal.method.cache.index.PALBasicMethodCacheIndex2;
import com.actionsoft.apps.coe.pal.pal.method.cache.index.PALBasicMethodCacheIndex3;
import com.actionsoft.apps.coe.pal.pal.method.model.PALBasicMethodModel;
import com.actionsoft.apps.resource.plugin.profile.CachePluginProfile;
import com.actionsoft.bpms.commons.cache.Cache;
import com.actionsoft.bpms.commons.cache.CacheManager;
/**
* 建模方法基础信息缓存Cache
*/
public class PALBasicMethodCache extends Cache<String, PALBasicMethodModel> {
public PALBasicMethodCache(CachePluginProfile configuration) {
super(configuration);
registeIndex(PALBasicMethodCacheIndex1.class, new PALBasicMethodCacheIndex1()); // methodId-wsId
registeIndex(PALBasicMethodCacheIndex2.class, new PALBasicMethodCacheIndex2()); // wsId
registeIndex(PALBasicMethodCacheIndex3.class, new PALBasicMethodCacheIndex3()); // methodId
}
/**
* getCache
*
* @return
*/
public static PALBasicMethodCache getCache() {
return CacheManager.getCache(PALBasicMethodCache.class);
}
/**
* put
*/
public static void putModel(PALBasicMethodModel model) {
putModel(model, true);
}
public static void putModel(PALBasicMethodModel model, boolean notifyCluster) {
getCache().put(model.getId(), model, notifyCluster);
}
/**
* 根据建模方法Id和资产库Id
*
* @param methodId 建模方法Id
* @param wsId 资产库Id
* @return
*/
public static PALBasicMethodModel getModelByMethodIdAndWsId(String methodId, String wsId) {
return getCache().getByIndexSingle(PALBasicMethodCacheIndex1.class, methodId + "-" + wsId);
}
/**
* 获取全部建模方法基础信息List
*
* @return
*/
public static List<PALBasicMethodModel> getAllBasicMethodModel() {
Iterator<PALBasicMethodModel> iterator = getCache().iterator();
return iteratorToList(iterator);
}
/**
* 根据资产库获取该资产库下全部建模方法基础信息List
*
* @return
*/
public static List<PALBasicMethodModel> getAllBasicMethodModel(String wsId) {
Iterator<PALBasicMethodModel> iterators = getCache().getByIndex(PALBasicMethodCacheIndex2.class, wsId);
return iteratorToList(iterators);
}
/**
* 根据appId获取该appId下全部建模方法
*
* @param appId 应用id
* @return methodIds
*/
public static List<String> getMethodIdByAppId(String appId) {
List<PALBasicMethodModel> methodModels = getAllBasicMethodModel();
return methodModels.stream().filter(model -> appId.equals(model.getAppId())).map(PALBasicMethodModel::getMethodId).distinct().collect(Collectors.toList());
}
/**
* 根据id删除建模方法基础信息
*
* @param methodId
*/
public static void removeById(String methodId) {
getCache().removeIndexByKey(PALBasicMethodCacheIndex3.class, methodId);
}
/**
* 清除全部建模方法基础信息
*/
public static void removeAllBasicMethodModel() {
List<PALBasicMethodModel> list = getAllBasicMethodModel();
if (list != null && list.size() > 0) {
for (PALBasicMethodModel model : list) {
getCache().remove(model.getId());
}
}
}
/**
* 清除资产库建模方法缓存
*
* @param wsId 资产库id
*/
public static void removeByWsId(String wsId) {
getCache().removeIndexByKey(PALBasicMethodCacheIndex2.class, wsId);
}
/**
* 清除资产库建模方法缓存
*
* @param wsId 资产库Id
* @param methodId 建模方法Id
*/
public static void removeByWsIdAndMethodId(String wsId, String methodId) {
getCache().removeIndexByKey(PALBasicMethodCacheIndex1.class, methodId + "-" + wsId);
}
@Override
protected void load() {
}
}

View File

@ -0,0 +1,156 @@
package com.actionsoft.apps.coe.pal.pal.method.cache;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.actionsoft.apps.coe.pal.pal.method.cache.index.PALMethodSchemaCacheIndex1;
import com.actionsoft.apps.coe.pal.pal.method.cache.index.PALMethodSchemaCacheIndex2;
import com.actionsoft.apps.coe.pal.pal.method.cache.index.PALMethodSchemaCacheIndex3;
import com.actionsoft.apps.coe.pal.pal.method.cache.index.PALMethodSchemaCacheIndex4;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodSchemaModel;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodShapeSchemaModel;
import com.actionsoft.apps.resource.plugin.profile.CachePluginProfile;
import com.actionsoft.bpms.commons.cache.Cache;
import com.actionsoft.bpms.commons.cache.CacheManager;
import com.actionsoft.i18n.I18nRes;
/**
* 形状定义schema cache
*
* @author sunlianhui
*/
public class PALMethodSchemaCache extends Cache<String, PALMethodSchemaModel> {
public PALMethodSchemaCache(CachePluginProfile configuration) {
super(configuration);
registeIndex(PALMethodSchemaCacheIndex1.class, new PALMethodSchemaCacheIndex1()); // methodId
registeIndex(PALMethodSchemaCacheIndex2.class, new PALMethodSchemaCacheIndex2()); // methodId-lang
registeIndex(PALMethodSchemaCacheIndex3.class, new PALMethodSchemaCacheIndex3()); // methodId-wsId-lang
registeIndex(PALMethodSchemaCacheIndex4.class, new PALMethodSchemaCacheIndex4()); // wsId
}
/**
* getCache
*
* @return
*/
public static PALMethodSchemaCache getCache() {
return CacheManager.getCache(PALMethodSchemaCache.class);
}
/**
* getModel
*
* @param id
* @return
*/
public static PALMethodSchemaModel getModelById(String id) {
return getCache().get(id);
}
public static List<PALMethodSchemaModel> getModelListByMethodId(String methodId) {
return iteratorToList(getCache().getByIndex(PALMethodSchemaCacheIndex1.class, methodId));
}
public static PALMethodSchemaModel getModelListByMethodIdAndLang(String methodId, String lang) {
return getCache().getByIndexSingle(PALMethodSchemaCacheIndex2.class, methodId + "-" + lang);
}
public static PALMethodSchemaModel getModelListByMethodIdAndLangAndWsId(String methodId, String lang, String wsId) {
return getCache().getByIndexSingle(PALMethodSchemaCacheIndex3.class, methodId + "-" + wsId + "-" + lang);
}
/**
* 获取图元是否允许出现复制Map
*
* @param wsId 资产库id
* @param methodId 建模方法Id
* @return map
*/
public static Map<String, Boolean> shapeAllowOccurrence(String wsId, String methodId) {
PALMethodSchemaModel schemaModel = getModelListByMethodIdAndLangAndWsId(methodId, I18nRes.getUserLanguage(), wsId);
if (schemaModel != null) {
List<PALMethodShapeSchemaModel> shapeSchemaList = schemaModel.getShapeSchemaList();
return shapeSchemaList.stream().collect(Collectors.toMap(PALMethodShapeSchemaModel::getKey, PALMethodShapeSchemaModel::isAllowOccurrence, (existingValue, newValue) -> existingValue));
}
return new HashMap<>();
}
/**
* 根据形状key值获取形状
*
* @param wsId 资产库Id
* @param lang 语言
* @param methodId 建模方法Id
* @param shapeKey 形状key
* @return 形状模型
*/
public static PALMethodShapeSchemaModel getShapeByKey(String wsId, String lang, String methodId, String shapeKey) {
PALMethodSchemaModel schemaModel = getModelListByMethodIdAndLangAndWsId(methodId, lang, wsId);
List<PALMethodShapeSchemaModel> shapeSchemaList = schemaModel.getShapeSchemaList();
return shapeSchemaList.stream().filter(shape -> {
return shape.getKey().equals(shapeKey);
}).findFirst().orElse(null);
}
/**
* put
*/
public static void putModel(PALMethodSchemaModel model) {
putModel(model, true);
}
public static void putModel(PALMethodSchemaModel model, boolean notifyCluster) {
if (model != null) {
getCache().put(model.getId(), model, notifyCluster);
}
}
/**
* 根据id删除属性定义
*
* @param id
*/
public static void removeModelById(String id) {
getCache().remove(id);
}
public static void removeByMethodId(String methodId) {
List<PALMethodSchemaModel> list = getModelListByMethodId(methodId);
if (list != null) {
for (PALMethodSchemaModel model : list) {
removeModelById(model.getId());
}
}
}
public static void removeByMethodIdAndWsId(String methodId, String wsId) {
List<PALMethodSchemaModel> list = getModelListByMethodId(methodId);
if (list != null) {
for (PALMethodSchemaModel model : list) {
if (model.getWsId().equals(wsId))
removeModelById(model.getId());
}
}
}
public static void removeAll() {
Iterator<PALMethodSchemaModel> iterator = getCache().iterator();
while (iterator.hasNext()) {
PALMethodSchemaModel next = iterator.next();
getCache().remove(next.getId());
}
}
public static void removeByWsId(String wsId) {
getCache().removeIndexByKey(PALMethodSchemaCacheIndex4.class, wsId);
}
@Override
protected void load() {
}
}

View File

@ -0,0 +1,11 @@
package com.actionsoft.apps.coe.pal.pal.method.cache.index;
import com.actionsoft.apps.coe.pal.pal.method.model.PALBasicMethodModel;
import com.actionsoft.bpms.commons.cache.ListValueIndex;
public class PALBasicMethodCacheIndex1 extends ListValueIndex<String, PALBasicMethodModel> {
@Override
public String key(PALBasicMethodModel t) {
return t.getMethodId() + "-" + t.getWsId();
}
}

View File

@ -0,0 +1,11 @@
package com.actionsoft.apps.coe.pal.pal.method.cache.index;
import com.actionsoft.apps.coe.pal.pal.method.model.PALBasicMethodModel;
import com.actionsoft.bpms.commons.cache.ListValueIndex;
public class PALBasicMethodCacheIndex2 extends ListValueIndex<String, PALBasicMethodModel> {
@Override
public String key(PALBasicMethodModel t) {
return t.getWsId();
}
}

View File

@ -0,0 +1,11 @@
package com.actionsoft.apps.coe.pal.pal.method.cache.index;
import com.actionsoft.apps.coe.pal.pal.method.model.PALBasicMethodModel;
import com.actionsoft.bpms.commons.cache.ListValueIndex;
public class PALBasicMethodCacheIndex3 extends ListValueIndex<String, PALBasicMethodModel> {
@Override
public String key(PALBasicMethodModel t) {
return t.getMethodId();
}
}

View File

@ -0,0 +1,14 @@
package com.actionsoft.apps.coe.pal.pal.method.cache.index;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodSchemaModel;
import com.actionsoft.bpms.commons.cache.ListValueIndex;
/**
* 以methodId建立索引
*/
public class PALMethodSchemaCacheIndex1 extends ListValueIndex<String, PALMethodSchemaModel> {
@Override
public String key(PALMethodSchemaModel palMethodSchemaModel) {
return palMethodSchemaModel.getMethodId();
}
}

View File

@ -0,0 +1,14 @@
package com.actionsoft.apps.coe.pal.pal.method.cache.index;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodSchemaModel;
import com.actionsoft.bpms.commons.cache.SingleValueIndex;
/**
* 以methodId-lang建立索引
*/
public class PALMethodSchemaCacheIndex2 extends SingleValueIndex<String, PALMethodSchemaModel> {
@Override
public String key(PALMethodSchemaModel palMethodSchemaModel) {
return palMethodSchemaModel.getMethodId() + "-" + palMethodSchemaModel.getLang();
}
}

View File

@ -0,0 +1,11 @@
package com.actionsoft.apps.coe.pal.pal.method.cache.index;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodSchemaModel;
import com.actionsoft.bpms.commons.cache.ListValueIndex;
public class PALMethodSchemaCacheIndex3 extends ListValueIndex<String, PALMethodSchemaModel> {
@Override
public String key(PALMethodSchemaModel model) {
return model.getMethodId() + "-" + model.getWsId() + "-" + model.getLang();
}
}

View File

@ -0,0 +1,14 @@
package com.actionsoft.apps.coe.pal.pal.method.cache.index;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodSchemaModel;
import com.actionsoft.bpms.commons.cache.ListValueIndex;
/**
* 以methodId建立索引
*/
public class PALMethodSchemaCacheIndex4 extends ListValueIndex<String, PALMethodSchemaModel> {
@Override
public String key(PALMethodSchemaModel palMethodSchemaModel) {
return palMethodSchemaModel.getWsId();
}
}

View File

@ -0,0 +1,10 @@
package com.actionsoft.apps.coe.pal.pal.method.constant;
public interface MethodSchemaConst {
String SCHEMA_CATEGORY = "Schema.addCategory(*?);\r\n";
String SCHEMA_GLOBAL_COMMAND = "Schema.addGlobalCommand(*?);\r\n";
String SCHEMA_SHAPE = "Schema.addShape(*?);\r\n";
}

View File

@ -59,4 +59,7 @@ public interface PALMethodConst {
* flowchart的AppId
*/
public final static String APP_PROCESS_FLOWCHART = "com.actionsoft.apps.coe.method.process.flowchart";
String ATTR_FILE_DC_REPOSITORY_NAME = "attr_upfile";
}

View File

@ -0,0 +1,297 @@
package com.actionsoft.apps.coe.pal.pal.method.model;
import java.io.Serializable;
import com.actionsoft.apps.coe.pal.pal.method.util.PALMethodSchemaUtil;
import com.actionsoft.i18n.I18nRes;
/**
* 建模方法基础信息model
*/
public class PALBasicMethodModel implements Serializable {
/**
* methodId 全局唯一标识
*/
private String id;
/**
* 所属资产库Id
*/
private String wsId;
/**
* 建模方法Id
*/
private String methodId;
/**
* 建模方法标题
*/
private String title;
/**
* 建模方法标题-英文
*/
private String titleEn;
/**
* 建模方法标题-繁体
*/
private String titleBig5;
/**
* 建模方法描述
*/
private String desc;
/**
* 建模方法描述-英文
*/
private String descEn;
/**
* 建模方法描述-繁体
*/
private String descBig5;
/**
* 建模方法所属的建模分类,多个之间用逗号分割
*/
private String category;
/**
* 所属appId
*/
private String appId;
/**
* 是否文件夹类型建模方法
*/
private boolean isFolder;
/**
* 当前建模方法的分类
*/
private String methodType;
/**
* 建模方法图标
*/
private String iconCode;
/**
* 建模方法图标颜色
*/
private String iconColor;
/**
* 支持的建模方式多个则逗号分隔
*/
private String modelingMode;
/**
* 默认的建模方式
*/
private String defaultModelingMode;
/**
* 建模方法类型normal普通建模方法image图片库类型建模方法
*/
private String type;
/**
* 形状排序
*/
private String shapeSort;
/**
* 是否为自定义建模方法
*/
private boolean isCustom;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getWsId() {
return wsId;
}
public void setWsId(String wsId) {
this.wsId = wsId;
}
public String getMethodId() {
return methodId;
}
public void setMethodId(String methodId) {
this.methodId = methodId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getTitleEn() {
return titleEn;
}
public void setTitleEn(String titleEn) {
this.titleEn = titleEn;
}
public String getTitleBig5() {
return titleBig5;
}
public void setTitleBig5(String titleBig5) {
this.titleBig5 = titleBig5;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getDescEn() {
return descEn;
}
public void setDescEn(String descEn) {
this.descEn = descEn;
}
public String getDescBig5() {
return descBig5;
}
public void setDescBig5(String descBig5) {
this.descBig5 = descBig5;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public boolean isFolder() {
return isFolder;
}
public void setFolder(boolean folder) {
isFolder = folder;
}
public String getMethodType() {
return methodType;
}
public void setMethodType(String methodType) {
this.methodType = methodType;
}
public String getIconCode() {
return iconCode;
}
public void setIconCode(String iconCode) {
this.iconCode = iconCode;
}
public String getIconColor() {
return iconColor;
}
public void setIconColor(String iconColor) {
this.iconColor = iconColor;
}
public String getModelingMode() {
return modelingMode;
}
public void setModelingMode(String modelingMode) {
this.modelingMode = modelingMode;
}
public String getDefaultModelingMode() {
return defaultModelingMode;
}
public void setDefaultModelingMode(String defaultModelingMode) {
this.defaultModelingMode = defaultModelingMode;
}
public String getSchema() {
return PALMethodSchemaUtil.getSchema(id, wsId);
}
public String getCustomSchema() {
return "";
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getShapeSort() {
return shapeSort;
}
public void setShapeSort(String shapeSort) {
this.shapeSort = shapeSort;
}
public boolean isCustom() {
return isCustom;
}
public void setCustom(boolean custom) {
isCustom = custom;
}
/**
* title 多语言数据 标识建模方法名称
*/
public String getTitleI18N() {
String lang = I18nRes.getUserLanguage();
if ("cn".equals(lang)) {
return title;
} else if ("en".equals(lang)) {
return titleEn;
} else if ("big5".equals(lang)) {
return titleBig5;
}
return desc;
}
/**
* desc 多语言数据
*/
public String getDescI18N() {
String lang = I18nRes.getUserLanguage();
if ("cn".equals(lang)) {
return desc;
} else if ("en".equals(lang)) {
return descEn;
} else if ("big5".equals(lang)) {
return descBig5;
}
return desc;
}
@Override
public String toString() {
return "PALBasicMethodModel{" + "id='" + id + '\'' + ", wsId='" + wsId + '\'' + ", methodId='" + methodId + '\'' + ", title='" + title + '\'' + ", titleEn='" + titleEn + '\'' + ", titleBig5='" + titleBig5 + '\'' + ", desc='" + desc + '\'' + ", descEn='" + descEn + '\'' + ", descBig5='" + descBig5 + '\'' + ", category='" + category + '\'' + ", appId='" + appId + '\'' + ", isFolder=" + isFolder + ", methodType='" + methodType + '\'' + ", iconCode='" + iconCode + '\'' + ", iconColor='" + iconColor + '\'' + ", modelingMode='" + modelingMode + '\''
+ ", defaultModelingMode='" + defaultModelingMode + '\'' + ", type='" + type + '\'' + ", shapeSort='" + shapeSort + '\'' + ", isCustom=" + isCustom + '}';
}
}

View File

@ -33,6 +33,7 @@ public final class PALMethodAttributeModel implements Cloneable {
//新增两个属性desc和isRequired
private String desc;
private boolean isRequired;
private int index;// 用于排序
/**
* 该定义由哪个App提供
@ -237,4 +238,14 @@ public final class PALMethodAttributeModel implements Cloneable {
}
return null;
}
/**
* 用于排序
*/
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
}

View File

@ -0,0 +1,108 @@
package com.actionsoft.apps.coe.pal.pal.method.model;
import java.io.Serializable;
import com.actionsoft.i18n.I18nRes;
import com.alibaba.fastjson.JSONObject;
/**
* 图元分组实体类
*/
public class PALMethodCategorySchemaModel implements Serializable {
/**
* 全局唯一标识36位
**/
private String id;
/**
* category标识
*/
private String key;
/**
* 分组标题-中文
*/
private String text;
/**
* 分组标题-英文
*/
private String textEn;
/**
* 分组标题-繁体
*/
private String textBig5;
/**
* category内容
*/
private JSONObject content;
public PALMethodCategorySchemaModel() {
}
/**
* Getter And Setter
*/
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getTextEn() {
return textEn;
}
public void setTextEn(String textEn) {
this.textEn = textEn;
}
public String getTextBig5() {
return textBig5;
}
public void setTextBig5(String textBig5) {
this.textBig5 = textBig5;
}
public JSONObject getContent() {
return content;
}
public void setContent(JSONObject content) {
this.content = content;
}
public String getTextI18N() {
String lang = I18nRes.getUserLanguage();
if ("cn".equals(lang)) {
return text;
} else if ("en".equals(lang)) {
return textEn;
} else if ("big5".equals(lang)) {
return textBig5;
}
return text;
}
}

View File

@ -0,0 +1,49 @@
package com.actionsoft.apps.coe.pal.pal.method.model;
import java.io.Serializable;
public class PALMethodFunctionSchemaModel implements Serializable {
/**
* 全局唯一标识36位
*/
private String id;
/**
* shape标识
*/
private String key;
/**
* shape内容
*/
private String content;
public PALMethodFunctionSchemaModel() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}

View File

@ -0,0 +1,54 @@
package com.actionsoft.apps.coe.pal.pal.method.model;
import java.io.Serializable;
import com.alibaba.fastjson.JSONArray;
/**
* canvas片段引用实体类
*/
public class PALMethodGlobalCommandSchemaModel implements Serializable {
/**
* 全局唯一标识36位
*/
private String id;
/**
* globalCommand标识
*/
private String key;
/**
* globalCommand内容
*/
private JSONArray content;
public PALMethodGlobalCommandSchemaModel() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public JSONArray getContent() {
return content;
}
public void setContent(JSONArray content) {
this.content = content;
}
}

View File

@ -0,0 +1,142 @@
package com.actionsoft.apps.coe.pal.pal.method.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import com.actionsoft.apps.coe.pal.pal.method.util.PALMethodSchemaUtil;
/**
* 形状定义schema
*
* @author sunlianhui
*/
public final class PALMethodSchemaModel implements Serializable {
private String id;// 全局唯一标识
private String methodId;// 建模方法标识
private String wsId;// 资产库Id
private String appId;// 哪个App提供的
private String lang;// 语言标识
private Long lastModified;// xml最后修改日期用于scanner扫描更新
private String schema;// 形状定义
private String customSchema;// 自定义形状定义
private List<PALMethodCategorySchemaModel> categorySchemaList;// 图元分组List
private List<PALMethodGlobalCommandSchemaModel> globalCommandSchemaList;// canvas片段引用List
private List<PALMethodShapeSchemaModel> shapeSchemaList;// 形状定义List
private List<PALMethodFunctionSchemaModel> functionSchemaList;// 函数定义List
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getMethodId() {
return methodId;
}
public void setMethodId(String methodId) {
this.methodId = methodId;
}
public String getWsId() {
return wsId;
}
public void setWsId(String wsId) {
this.wsId = wsId;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getLang() {
return lang;
}
public void setLang(String lang) {
this.lang = lang;
}
public Long getLastModified() {
return lastModified;
}
public void setLastModified(Long lastModified) {
this.lastModified = lastModified;
}
public String getSchema() {
return PALMethodSchemaUtil.getSchema(methodId, wsId);
}
public void setSchema(String schema) {
this.schema = schema;
}
public String getCustomSchema() {
return customSchema;
}
public void setCustomSchema(String customSchema) {
this.customSchema = customSchema;
}
public List<PALMethodCategorySchemaModel> getCategorySchemaList() {
if (CollectionUtils.isEmpty(categorySchemaList)) {
return new ArrayList<>();
}
return categorySchemaList;
}
public void setCategorySchemaList(List<PALMethodCategorySchemaModel> categorySchemaList) {
this.categorySchemaList = categorySchemaList;
}
public List<PALMethodGlobalCommandSchemaModel> getGlobalCommandSchemaList() {
if (CollectionUtils.isEmpty(globalCommandSchemaList)) {
return new ArrayList<>();
}
return globalCommandSchemaList;
}
public void setGlobalCommandSchemaList(List<PALMethodGlobalCommandSchemaModel> globalCommandSchemaList) {
this.globalCommandSchemaList = globalCommandSchemaList;
}
public List<PALMethodShapeSchemaModel> getShapeSchemaList() {
if (CollectionUtils.isEmpty(shapeSchemaList)) {
return new ArrayList<>();
}
return shapeSchemaList;
}
public void setShapeSchemaList(List<PALMethodShapeSchemaModel> shapeSchemaList) {
this.shapeSchemaList = shapeSchemaList;
}
public List<PALMethodFunctionSchemaModel> getFunctionSchemaList() {
if (CollectionUtils.isEmpty(functionSchemaList)) {
return new ArrayList<>();
}
return functionSchemaList;
}
public void setFunctionSchemaList(List<PALMethodFunctionSchemaModel> functionSchemaList) {
this.functionSchemaList = functionSchemaList;
}
@Override
public String toString() {
return "PALMethodSchemaModel{" + "id='" + id + '\'' + ", methodId='" + methodId + '\'' + ", appId='" + appId + '\'' + ", lang='" + lang + '\'' + ", lastModified=" + lastModified + ", schema='" + schema + '\'' + ", customSchema='" + customSchema + '\'' + '}';
}
}

View File

@ -0,0 +1,184 @@
package com.actionsoft.apps.coe.pal.pal.method.model;
import java.io.Serializable;
import com.actionsoft.i18n.I18nRes;
import com.alibaba.fastjson.JSONObject;
/**
* 形状定义实体类
*/
public class PALMethodShapeSchemaModel implements Serializable {
/**
* 全局位置标识36位
*/
private String id;
/**
* shape标识
*/
private String key;
/**
* 样式分类colorOverlay:颜色叠加noColorOverlay:没有颜色叠加
*/
private String styleType;
/**
* 是否出厂自带的形状
*/
private boolean isDefault;
/**
* 形状类型image:全部是图片类型canvas:canvas画出来或canvas+图标类型
*/
private String shapeType;
/**
* 是否允许出现复制
*/
private boolean allowOccurrence;
/**
* 是否启用
*/
private boolean isAvailable;
/**
* 标题-中文
*/
private String title;
/**
* 标题-英文
*/
private String titleEn;
/**
* 标题-繁体
*/
private String titleBig5;
/**
* 是否为自定义图元
*/
private boolean isCustomSchema;
/**
* shape内容
*/
private JSONObject content;
public PALMethodShapeSchemaModel() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getStyleType() {
return styleType;
}
public void setStyleType(String styleType) {
this.styleType = styleType;
}
public boolean isDefault() {
return isDefault;
}
public void setDefault(boolean aDefault) {
isDefault = aDefault;
}
public String getShapeType() {
return shapeType;
}
public void setShapeType(String shapeType) {
this.shapeType = shapeType;
}
public boolean isAllowOccurrence() {
return allowOccurrence;
}
public void setAllowOccurrence(boolean allowOccurrence) {
this.allowOccurrence = allowOccurrence;
}
public boolean isAvailable() {
return isAvailable;
}
public void setAvailable(boolean available) {
isAvailable = available;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getTitleEn() {
return titleEn;
}
public void setTitleEn(String titleEn) {
this.titleEn = titleEn;
}
public String getTitleBig5() {
return titleBig5;
}
public void setTitleBig5(String titleBig5) {
this.titleBig5 = titleBig5;
}
public boolean isCustomSchema() {
return isCustomSchema;
}
public void setCustomSchema(boolean customSchema) {
isCustomSchema = customSchema;
}
public JSONObject getContent() {
return content;
}
public void setContent(JSONObject content) {
this.content = content;
}
public String getTitleI18N() {
String lang = I18nRes.getUserLanguage();
if ("cn".equals(lang)) {
return title;
} else if ("en".equals(lang)) {
return titleEn;
} else if ("big5".equals(lang)) {
return titleBig5;
}
return title;
}
}

View File

@ -0,0 +1,888 @@
package com.actionsoft.apps.coe.pal.pal.method.util;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.actionsoft.apps.coe.pal.pal.method.cache.PALBasicMethodCache;
import com.actionsoft.apps.coe.pal.pal.method.cache.PALMethodSchemaCache;
import com.actionsoft.apps.coe.pal.pal.method.constant.MethodSchemaConst;
import com.actionsoft.apps.coe.pal.pal.method.model.PALBasicMethodModel;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodCategorySchemaModel;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodFunctionSchemaModel;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodGlobalCommandSchemaModel;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodSchemaModel;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodShapeSchemaModel;
import com.actionsoft.apps.coe.pal.pal.repository.designer.image.util.CoeDesignerImageUtil;
import com.actionsoft.bpms.server.conf.portal.AWSPortalConf;
import com.actionsoft.i18n.I18nRes;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
public class PALMethodSchemaUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(PALMethodSchemaUtil.class);
public static String getSchema(String methodId, String wsId) {
PALBasicMethodModel basicModel = PALBasicMethodCache.getModelByMethodIdAndWsId(methodId, wsId);
PALMethodSchemaModel schemaModel = PALMethodSchemaCache.getModelListByMethodIdAndLangAndWsId(methodId, I18nRes.getUserLanguage(), wsId);
if (schemaModel == null || basicModel == null) {
return "";
}
StringBuilder schemaBuilder = new StringBuilder();
// 拼接图元分组
List<PALMethodCategorySchemaModel> categorySchemaList = schemaModel.getCategorySchemaList();
if (CollectionUtils.isNotEmpty(categorySchemaList)) {
for (PALMethodCategorySchemaModel categorySchema : categorySchemaList) {
JSONObject content = categorySchema.getContent();
String contentStr = content.toJSONString();
if (StringUtils.isEmpty(contentStr)) {
continue;
}
String replace = MethodSchemaConst.SCHEMA_CATEGORY.replace("*?", contentStr);
schemaBuilder.append(replace);
}
}
// 拼接function
List<PALMethodFunctionSchemaModel> functionSchemaList = schemaModel.getFunctionSchemaList();
if (CollectionUtils.isNotEmpty(functionSchemaList)) {
for (PALMethodFunctionSchemaModel functionSchemaModel : functionSchemaList) {
String content = functionSchemaModel.getContent();
if (StringUtils.isEmpty(content)) {
continue;
}
schemaBuilder.append(content);
schemaBuilder.append("\r\n");
}
}
// 拼接canvas引用片段
List<PALMethodGlobalCommandSchemaModel> globalCommandSchemaList = schemaModel.getGlobalCommandSchemaList();
if (CollectionUtils.isNotEmpty(globalCommandSchemaList)) {
for (PALMethodGlobalCommandSchemaModel globalCommandSchemaModel : globalCommandSchemaList) {
String key = globalCommandSchemaModel.getKey();
JSONArray content = globalCommandSchemaModel.getContent();
if (content == null || content.isEmpty() || StringUtils.isEmpty(key)) {
continue;
}
String contentStr = content.toJSONString();
String replace = MethodSchemaConst.SCHEMA_GLOBAL_COMMAND.replace("*?", "\"" + key + "\", " + contentStr);
schemaBuilder.append(replace);
}
}
// 拼接形状定义
String shapeSort = basicModel.getShapeSort();
if (shapeSort == null) {
shapeSort = "";
}
List<String> shapeSortList = new ArrayList<>(Arrays.asList(shapeSort.split(",")));
Map<String, Integer> schemaMap = new HashMap<>();
List<PALMethodShapeSchemaModel> shapeSchemaList = schemaModel.getShapeSchemaList();
if (CollectionUtils.isNotEmpty(shapeSchemaList)) {
for (PALMethodShapeSchemaModel shapeSchemaModel : shapeSchemaList) {
// 禁用则跳过
if (!shapeSchemaModel.isAvailable()) {
continue;
}
JSONObject content = shapeSchemaModel.getContent();
if (content == null || content.isEmpty()) {
continue;
}
String png = "../apps/" + schemaModel.getAppId() + "/img/method/" + methodId + "/icon/" + shapeSchemaModel.getKey() + ".png";
String schemaPng = "";
// 是否使用canvas
boolean isCanvasDraw = false;
// 临时转换png为base64
try {
File file = new File(AWSPortalConf.getLocation() + png.substring(3));
if (!shapeSchemaModel.isCustomSchema() && file.exists()) {
// schemaPng = png;
schemaPng = CoeDesignerImageUtil.convertCommonImageToBase64(file);
} else {
isCanvasDraw = true;
}
} catch (IOException e) {
LOGGER.error("图片转base64失败路径{}", png, e);
}
content.put("schemaPng", schemaPng);
content.put("isCanvasDraw", isCanvasDraw);
String contentStr = content.toJSONString();
String replace = MethodSchemaConst.SCHEMA_SHAPE.replace("*?", contentStr);
schemaMap.put(replace, shapeSortList.indexOf(shapeSchemaModel.getKey()));
}
// 将Map转换为List并排序
List<String> sortedKeys = schemaMap.entrySet().stream().sorted(Map.Entry.comparingByValue()).map(Map.Entry::getKey).collect(Collectors.toList());
schemaBuilder.append(String.join("", sortedKeys));
}
return schemaBuilder.toString();
}
//
// /**
// * 获取形状Map
// *
// * @param wsId 资产库Id
// * @param methodId 建模方法Id
// * @param shapes map
// */
// public static void getShapesMap(String wsId, String methodId, Map<String, String> shapes) {
// String lang = I18nRes.getUserLanguage();
// PALMethodSchemaModel schemaModel = PALMethodSchemaCache.getModelListByMethodIdAndLangAndWsId(methodId, lang, wsId);
// if (schemaModel == null) {
// return;
// }
// List<PALMethodShapeSchemaModel> shapeSchemaList = schemaModel.getShapeSchemaList();
// for (PALMethodShapeSchemaModel shapeSchemaModel : shapeSchemaList) {
// String name = shapeSchemaModel.getKey();
// shapes.put(name, shapeSchemaModel.getTitleI18N());
// }
// }
//
// /**
// * 更新形状定义缓存
// * 通过给定的建模方法ID和原始的形状定义更新针对所有语言的模式缓存
// *
// * @param methodId 建模方法ID
// * @param originalSchema schema定义
// */
// public static void updateSchemaCache(String methodId, String originalSchema, String wsId) {
// PALBasicMethodModel basicModel = PALBasicMethodCache.getModelByMethodIdAndWsId(methodId, wsId);
// if (basicModel != null) {
// String appId = basicModel.getAppId();
// List<LanguageModel> languageModels = AWSPortalConf.getLanguages();
// for (LanguageModel languageModel : languageModels) {
// String lang = languageModel.getName();
// String schema = transformSchemaByLanguage(appId, originalSchema, lang);
// PALMethodSchemaCache.getModelListByMethodIdAndLangAndWsId(methodId, lang, wsId).setSchema(schema);
// }
// }
// }
//
// /**
// * 更新自定义的形状定义缓存
// * 通过给定的建模方法ID和原始的自定义形状定义更新针对所有语言的模式缓存
// *
// * @param methodId 建模方法ID
// * @param originalSchema 自定义schema定义
// */
// public static void updateCustomSchemaCache(String methodId, String originalSchema, String wsId) {
// PALBasicMethodModel basicModel = PALBasicMethodCache.getModelByMethodIdAndWsId(methodId, wsId);
// if (basicModel != null) {
// String appId = basicModel.getAppId();
// List<LanguageModel> languageModels = AWSPortalConf.getLanguages();
// for (LanguageModel languageModel : languageModels) {
// String lang = languageModel.getName();
// String customSchema = transformSchemaByLanguage(appId, originalSchema, lang);
// PALMethodSchemaCache.getModelListByMethodIdAndLangAndWsId(methodId, lang, wsId).setCustomSchema(customSchema);
// }
// }
// }
//
// /**
// * 更新指定应用下指定建模方法的自定义形状定义缓存
// *
// * @param app AppContext对象
// * @param methodId 建模方法ID
// * @param fileName 自定义形状定义文件名称
// * 该方法通过建模方法ID和文件名从应用的建模方法中加载自定义形状定义内容然后更新对应的自定义形状定义缓存
// */
// public static void updateCustomSchemaCache(AppContext app, String methodId, String fileName, String wsId, boolean isCustom) {
// String customSchema = MethodAppManager.loadCustomSchemaByApp(app, methodId, fileName, wsId, isCustom);
// updateCustomSchemaCache(methodId, customSchema, wsId);
// }
//
// /**
// * 更新指定应用下指定建模方法的形状定义缓存
// *
// * @param app AppContext对象
// * @param methodId 建模方法ID
// * @param fileName 形状定义文件名称
// * 该方法通过建模方法ID和文件名从应用的建模方法中加载形状定义内容然后更新对应的形状定义缓存
// */
// public static void updateSchemaCache(AppContext app, String methodId, String fileName, String wsId, boolean isCustom) {
// String schema = MethodAppManager.loadSchemaByApp(app, methodId, fileName, wsId, isCustom);
// updateSchemaCache(methodId, schema, wsId);
// }
//
// /**
// * 根据指定语言翻译形状定义信息
// *
// * @param app AppContext对象
// * @param originalSchema 原始形状定义信息
// * @param lang 目标语言代码指定要将词汇翻译成的语言例如cnenbig5
// * @return 转换后的模式字符串其中的关键词被翻译成指定语言
// */
// public static String transformSchemaByLanguage(AppContext app, String originalSchema, String lang) {
// return transformSchemaByLanguage(app.getId(), originalSchema, lang);
// }
//
// /**
// * 根据指定语言翻译形状定义信息
// *
// * @param appId 应用ID
// * @param originalSchema 原始形状定义信息
// * @param lang 目标语言代码指定要将词汇翻译成的语言例如cnenbig5
// * @return 转换后的模式字符串其中的关键词被翻译成指定语言
// */
// public static String transformSchemaByLanguage(String appId, String originalSchema, String lang) {
// Map<String, Map<String, String>> map = I18nRes.getResourceMapByApp(appId);
// // 对map的键进行排序确保更长的键先被处理并且只包含中文字符的键被加入
// Map<String, Map<String, String>> sortedMap = new TreeMap<>(Comparator.comparingInt(String::length).reversed() // 首先根据字符串长度排序
// .thenComparing(Comparator.naturalOrder())); // 长度相同则根据字符串的自然顺序排序
//
// // 正则表达式用于检测字符串中是否包含中文字符不含中文字符会造成后续判断误伤
// String chineseCharactersPattern = "[\u4e00-\u9fa5]";
//
// // 过滤并放入sortedMap
// for (Map.Entry<String, Map<String, String>> entry : map.entrySet()) {
// if (entry.getKey().matches(".*" + chineseCharactersPattern + ".*")) {
// sortedMap.put(entry.getKey(), entry.getValue());
// }
// }
//
// StringBuilder result = new StringBuilder();
// int start = 0;
//
// // 遍历替换
// for (int i = 0; i < originalSchema.length(); i++) {
// if (originalSchema.charAt(i) == '"') { // 检测到双引号寻找下一个双引号以确定完整的词汇
// int nextQuote = originalSchema.indexOf('"', i + 1);
// if (nextQuote > i) {
// String completeWord = originalSchema.substring(i, nextQuote + 1); // 包括双引号的完整词汇
// for (String key : sortedMap.keySet()) {
// // 如果找到匹配的完整词汇
// if (completeWord.contains("\"" + key + "\"")) {
// String replacement = sortedMap.get(key).containsKey(lang) ? sortedMap.get(key).get(lang) : sortedMap.get(key).get("cn");
// completeWord = completeWord.replace("\"" + key + "\"", "\"" + replacement + "\"");
// }
// }
// result.append(originalSchema, start, i).append(completeWord); // 添加替换后的完整词汇
// i = nextQuote; // 跳到下一个双引号之后
// start = i + 1;
// }
// }
// }
// if (start < originalSchema.length()) {
// result.append(originalSchema.substring(start)); // 添加剩余部分
// }
// return result.toString();
// }
//
// private static JSONObject transformContentByLanguage(String methodId, Element element, String content, String lang, String elementType) {
// return transformContentByLanguage(methodId, element, content, lang, elementType, "", "");
// }
//
// /**
// * 根据指定语言翻译形状定义信息
// *
// * @param element xml中需要国际化的标签元素
// * @param content 原始形状定义信息
// * @param lang 目标语言代码指定要将词汇翻译成的语言例如cnenbig5
// * @param elementType 标签元素类型category:图元分组shape:形状定义
// * @param drawIcon shape中drawIcon函数
// * @param onCreated shape中onCreated函数
// * @return 转换后的模式jsonObject对象
// */
// private static JSONObject transformContentByLanguage(String methodId, Element element, String content, String lang, String elementType, String drawIcon, String onCreated) {
// if (StringUtils.isEmpty(content)) {
// return new JSONObject();
// }
// String type = "";
// String replace = "";
//
// if ("category".equals(elementType)) {
// type = "text";
// } else if ("shape".equals(elementType)) {
// type = "title";
// }
//
// if ("cn".equals(lang)) {
// replace = element.attributeValue(type);
// } else if ("en".equals(lang)) {
// replace = element.attributeValue(type + "-en");
// } else if ("big5".equals(lang)) {
// replace = element.attributeValue(type + "-big5");
// }
// JSONObject contentObj;
// try {
// // 替换所有换行以及前后空格
// content = content.replaceAll("\\s*\\n\\s*", "");
// contentObj = JSONObject.parseObject(content);
// if ("category".equals(elementType)) {
// // 替换text
// contentObj.put("text", replace);
// } else if ("shape".equals(elementType)) {
// if (UtilString.isNotEmpty(replace)) {
// contentObj.put("title", replace);
// }
// }
// if (StringUtils.isNotEmpty(drawIcon)) {
// contentObj.put("drawIcon", drawIcon);
// }
// if (StringUtils.isNotEmpty(onCreated)) {
// contentObj.put("onCreated", onCreated);
// }
// } catch (JSONException e) {
// LOGGER.error("[methodId={}, key={}]String transform to JSONObject error:{}", methodId, element.attributeValue("key"), content, e);
// return new JSONObject();
// }
//
// return contentObj;
// }
//
// /**
// * 加载默认的例如基础形状泳池泳道这类公共的形状定义
// *
// * @param methodId 建模方法ID
// * @param fileName tpl文件名称
// */
// public static void loadDefaultSchemaCache(String methodId, String fileName) {
// String path = AppsAPIManager.getInstance().getAppContext(CoEConstant.APP_ID).getPath() + PALMethodConst.DIR_ROOT_CONFIG + fileName;
// Document xmlDocument = XMLUtil.readXML(path);
// if (xmlDocument != null) {
// List<LanguageModel> languageModels = AWSPortalConf.getLanguages();
// for (LanguageModel languageModel : languageModels) {
// String lang = languageModel.getName();
// PALMethodSchemaModel psmm = new PALMethodSchemaModel();
// psmm.setId(PALMethodUtil.getMethodSchemaModelId("default", CoEConstant.APP_ID, methodId, lang));
// psmm.setMethodId(methodId);
// psmm.setAppId(CoEConstant.APP_ID);
// psmm.setLang(lang);
// psmm.setWsId("default");
// //psmm.setSchema(PALMethodSchemaUtil.transformSchemaByLanguage(CoEConstant.APP_ID, basicTpl, lang));
// buildSchemaConfig(CoEConstant.APP_ID, methodId, psmm, xmlDocument, lang, null);
// // 放入缓存
// PALMethodSchemaCache.putModel(psmm);
// }
// }
// }
//
// /**
// * 初始化 diagram.schema.xml 文件
// */
// public static void initSchemaXml(DCContext configDc, String wsId, String methodId, PALBasicMethodModel basicModel) {
// DCContext dcContext = configDc.clone();
// dcContext.setFileName(MethodConfigEnum.SCHEMA_CONFIG.getFile());
// Document document = DocumentHelper.createDocument();
// Element schema = document.addElement("schema");
// Element categories = schema.addElement("categories");
// Element category = categories.addElement("category");
// String categoryStr = handleMethodToCategory(methodId);
// category.addAttribute("key", categoryStr);
// category.addAttribute("text", basicModel.getTitle());
// category.addAttribute("text-en", basicModel.getTitleEn());
// category.addAttribute("text-big5", basicModel.getTitleBig5());
// JSONObject jo = new JSONObject();
// jo.put("name", categoryStr);
// jo.put("text", basicModel.getTitle());
// jo.put("dataAttributes", new JSONArray());
// category.setText(jo.toJSONString());
// // 新增三个空标签
// schema.addElement("functions");
// schema.addElement("globalCommands");
// schema.addElement("shapes");
//
// XMLUtil.writeXml(document, dcContext);
//
// // 缓存重新加载
// PALMethodSchemaUtil.reloadCache(CoEConstant.APP_ID, wsId, methodId, document, null);
// }
//
// /**
// * 建模方法转category
// */
// public static String handleMethodToCategory(String methodId) {
// if (methodId == null) {
// return null;
// }
// return methodId.replace("_", "-").replace(".", "_");
// }
//
// /**
// * 构建schema配置
// * 该方法通过解析XML文档构建出图元分类函数全局命令和形状定义等配置信息并填充到PALMethodSchemaModel对象中
// *
// * @param appId AppId
// * @param psmm PAL方法模式模型用于接收构建好的schema配置信息
// * @param schemaDocument schema文档包含待解析的XML文档
// * @param lang 语言代码指定解析时使用的语言
// * @param schemaKeys 图元key集合用于判断是否为自定义图元
// */
// public static void buildSchemaConfig(String appId, String methodId, PALMethodSchemaModel psmm, Document schemaDocument, String lang, Set<String> schemaKeys) {
// try {
// Element rootElement = schemaDocument.getRootElement();
//
// // 构建图元分类
// List<PALMethodCategorySchemaModel> categoryList = buildSchemaList(methodId, rootElement, MethodSchemaEnum.SCHEMA_CATEGORY, PALMethodCategorySchemaModel.class, appId, lang);
// psmm.setCategorySchemaList(categoryList);
//
// // 构建function
// List<PALMethodFunctionSchemaModel> functionList = buildSchemaList(methodId, rootElement, MethodSchemaEnum.SCHEMA_FUNCTION, PALMethodFunctionSchemaModel.class, appId, lang);
// psmm.setFunctionSchemaList(functionList);
//
// // 构建canvas片段引用
// List<PALMethodGlobalCommandSchemaModel> globalCommandList = buildSchemaList(methodId, rootElement, MethodSchemaEnum.SCHEMA_GLOBAL_COMMAND, PALMethodGlobalCommandSchemaModel.class, appId, lang);
// psmm.setGlobalCommandSchemaList(globalCommandList);
//
// // 构建形状定义
// List<PALMethodShapeSchemaModel> shapeList = buildSchemaList(methodId, rootElement, MethodSchemaEnum.SCHEMA_SHAPE, PALMethodShapeSchemaModel.class, appId, lang, schemaKeys);
// psmm.setShapeSchemaList(shapeList);
//
// } catch (Exception e) {
// LOGGER.error(e.getMessage(), e);
// }
// }
//
// /**
// * 重新加载 图元缓存数据
// */
// public static void reloadCache(String appId, String wsId, String methodId, Document document, Set<String> schemaKeys) {
// // 缓存更新
// PALMethodSchemaCache.removeByMethodIdAndWsId(methodId, wsId);
// List<LanguageModel> languageModels = AWSPortalConf.getLanguages();
// for (LanguageModel languageModel : languageModels) {
// String lang = languageModel.getName();
// PALMethodSchemaModel psmm = new PALMethodSchemaModel();
// psmm.setId(PALMethodUtil.getMethodSchemaModelId(wsId, appId, methodId, lang));
// psmm.setAppId(appId);
// psmm.setMethodId(methodId);
// psmm.setWsId(wsId);
// psmm.setLang(lang);
// PALMethodSchemaUtil.buildSchemaConfig(appId, methodId, psmm, document, lang, schemaKeys);
// // 放入缓存
// PALMethodSchemaCache.putModel(psmm);
// }
// }
//
// /**
// * 根据给定的XML根元素构建并返回一个模型列表
// *
// * @param rootElement XML文档的根元素
// * @param schemaEnum 指定的模式枚举用于确定要解析的XML子元素
// * @param modelClass 模型类的Class对象用于实例化模型对象
// * @param appId 应用Id
// * @param lang 国际化参数
// * @return 返回一个包含解析和实例化后模型对象的列表
// */
// private static <T> List<T> buildSchemaList(String methodId, Element rootElement, MethodSchemaEnum schemaEnum, Class<T> modelClass, String appId, String lang) {
// return buildSchemaList(methodId, rootElement, schemaEnum, modelClass, appId, lang, null);
// }
//
// /**
// * 根据给定的XML根元素构建并返回一个模型列表
// *
// * @param rootElement XML文档的根元素
// * @param schemaEnum 指定的模式枚举用于确定要解析的XML子元素
// * @param modelClass 模型类的Class对象用于实例化模型对象
// * @param appId 应用Id
// * @param lang 国际化参数
// * @param schemaKeys 图元key集合用于判断是否为自定义图元
// * @return 返回一个包含解析和实例化后模型对象的列表
// */
// private static <T> List<T> buildSchemaList(String methodId, Element rootElement, MethodSchemaEnum schemaEnum, Class<T> modelClass, String appId, String lang, Set<String> schemaKeys) {
// List<T> modelList = new ArrayList<>();
// Element schemaElement = rootElement.element(schemaEnum.getTagGroupName());
// if (schemaElement != null) {
// List<Element> elements = schemaElement.elements(schemaEnum.getTagName());
// for (Element element : elements) {
// T model;
// try {
// // 实例化
// model = modelClass.getDeclaredConstructor().newInstance();
// // 设置公共部分
// model.getClass().getMethod("setId", String.class).invoke(model, UUIDGener.getUUID());
// model.getClass().getMethod("setKey", String.class).invoke(model, element.attributeValue("key"));
//
// // 设置PALMethodCategorySchemaModel独有部分
// Method textMethod = CoEReflectionUtils.findMethod(model.getClass(), "setText", String.class);
// if (textMethod != null && StringUtils.isNotEmpty(element.attributeValue("text"))) {
// textMethod.invoke(model, element.attributeValue("text"));
// }
// Method textEnMethod = CoEReflectionUtils.findMethod(model.getClass(), "setTextEn", String.class);
// if (textEnMethod != null && StringUtils.isNotEmpty(element.attributeValue("text-en"))) {
// textEnMethod.invoke(model, element.attributeValue("text-en"));
// }
// Method textBig5Method = CoEReflectionUtils.findMethod(model.getClass(), "setTextBig5", String.class);
// if (textBig5Method != null && StringUtils.isNotEmpty(element.attributeValue("text-big5"))) {
// textBig5Method.invoke(model, element.attributeValue("text-big5"));
// }
//
// // 设置PALMethodShapeSchemaModel独有部分
// Method styleTypeMethod = CoEReflectionUtils.findMethod(model.getClass(), "setStyleType", String.class);
// if (styleTypeMethod != null && StringUtils.isNotEmpty(element.attributeValue("styleType"))) {
// styleTypeMethod.invoke(model, element.attributeValue("styleType"));
// }
// Method defaultMethod = CoEReflectionUtils.findMethod(model.getClass(), "setDefault", boolean.class);
// if (defaultMethod != null && StringUtils.isNotEmpty(element.attributeValue("isDefault"))) {
// defaultMethod.invoke(model, Boolean.valueOf(element.attributeValue("isDefault")));
// }
// Method shapeTypeMethod = CoEReflectionUtils.findMethod(model.getClass(), "setShapeType", String.class);
// if (shapeTypeMethod != null && StringUtils.isNotEmpty(element.attributeValue("shapeType"))) {
// shapeTypeMethod.invoke(model, element.attributeValue("shapeType"));
// }
// Method allowOccurenceMethod = CoEReflectionUtils.findMethod(model.getClass(), "setAllowOccurrence", boolean.class);
// if (allowOccurenceMethod != null && StringUtils.isNotEmpty(element.attributeValue("allowOccurrence"))) {
// allowOccurenceMethod.invoke(model, Boolean.valueOf(element.attributeValue("allowOccurrence")));
// }
// Method availableMethod = CoEReflectionUtils.findMethod(model.getClass(), "setAvailable", boolean.class);
// if (availableMethod != null && StringUtils.isNotEmpty(element.attributeValue("isAvailable"))) {
// availableMethod.invoke(model, Boolean.valueOf(element.attributeValue("isAvailable")));
// }
// Method titleMethod = CoEReflectionUtils.findMethod(model.getClass(), "setTitle", String.class);
// if (titleMethod != null && StringUtils.isNotEmpty(element.attributeValue("title"))) {
// titleMethod.invoke(model, element.attributeValue("title"));
// }
// Method titleEnMethod = CoEReflectionUtils.findMethod(model.getClass(), "setTitleEn", String.class);
// if (titleEnMethod != null && StringUtils.isNotEmpty(element.attributeValue("title-en"))) {
// titleEnMethod.invoke(model, element.attributeValue("title-en"));
// }
// Method titleBig5Method = CoEReflectionUtils.findMethod(model.getClass(), "setTitleBig5", String.class);
// if (titleBig5Method != null && StringUtils.isNotEmpty(element.attributeValue("title-big5"))) {
// titleBig5Method.invoke(model, element.attributeValue("title-big5"));
// }
// if (schemaKeys != null) {
// Method customSchemaMethod = CoEReflectionUtils.findMethod(model.getClass(), "setCustomSchema", boolean.class);
// if (customSchemaMethod != null) {
// customSchemaMethod.invoke(model, schemaKeys.contains(element.attributeValue("key")));
// }
// }
//
// // 设置content部分
// String content = element.getText();
// String drawIcon = "";
// String onCreated = "";
// Element drawIconElement = element.element("drawIcon");
// if (drawIconElement != null) {
// drawIcon = drawIconElement.getText();
// }
// Element onCreatedElement = element.element("onCreated");
// if (onCreatedElement != null) {
// onCreated = onCreatedElement.getText();
// }
// if (schemaEnum.name().equals(MethodSchemaEnum.SCHEMA_FUNCTION.name())) {
// model.getClass().getMethod("setContent", String.class).invoke(model, content);
// } else if (schemaEnum.name().equals(MethodSchemaEnum.SCHEMA_CATEGORY.name())) {
// // 对图元分组content进行国际化处理
// JSONObject contentObj = transformContentByLanguage(methodId, element, content, lang, "category");
// model.getClass().getMethod("setContent", JSONObject.class).invoke(model, contentObj);
// } else if (schemaEnum.name().equals(MethodSchemaEnum.SCHEMA_SHAPE.name())) {
// // 对形状定义进行国际化处理
// JSONObject contentObj = transformContentByLanguage(methodId, element, content, lang, "shape", drawIcon, onCreated);
// // 放入建模方法Id
// contentObj.put("methodId", methodId);
// model.getClass().getMethod("setContent", JSONObject.class).invoke(model, contentObj);
// } else if (schemaEnum.name().equals(MethodSchemaEnum.SCHEMA_GLOBAL_COMMAND.name())) {
// try {
// model.getClass().getMethod("setContent", JSONArray.class).invoke(model, JSONArray.parseArray(content));
// } catch (JSONException e) {
// LOGGER.error("[method={}, key={}]String transform to JSONArray error:{}", methodId, element.attributeValue("key"), content, e);
// }
// }
// modelList.add(model);
// } catch (Exception e) {
// // 适当的异常处理逻辑
// LOGGER.error(e.getMessage(), e);
// }
// }
// }
// return modelList;
// }
//
// /**
// * 返回对应图元id的 model数据
// */
// public static PALMethodShapeSchemaModel getShapeSchemaBySchemaId(String wsId, String methodId, String lang, String schemaId) {
// PALMethodSchemaModel schemaModel = PALMethodSchemaCache.getModelListByMethodIdAndLangAndWsId(methodId, lang, wsId);
// if (schemaModel != null) {
// return schemaModel.getShapeSchemaList().stream().filter(item -> item.getKey().equals(schemaId)).findFirst().orElse(null);
// }
// return null;
// }
//
// /**
// * 获取 默认 globalCommand 数据
// */
// public static JSONObject getDefaultGlobalCommand() {
// JSONObject jo = new JSONObject();
// String rectangle = "[{\n" + " action: \"move\",\n" + " x: \"0\",\n" + " y: \"0\"\n" + "},\n" + " {\n" + " action: \"line\",\n" + " x: \"w\",\n" + " y: \"0\"\n" + " },\n" + " {\n" + " action: \"line\",\n" + " x: \"w\",\n" + " y: \"h\"\n" + " },\n" + " {\n" + " action: \"line\",\n" + " x: \"0\",\n" + " y: \"h\"\n" + " },\n" + " {\n" + " action: \"close\"\n" + " }]";
// jo.put("rectangle", JSONArray.parseArray(rectangle));
// String round = "[{\n" + " action: \"move\",\n" + " x: \"0\",\n" + " y: \"h/2\"\n" + "},\n" + " {\n" + " action: \"curve\",\n" + " x1: \"0\",\n" + " y1: \"-h/6\",\n" + " x2: \"w\",\n" + " y2: \"-h/6\",\n" + " x: \"w\",\n" + " y: \"h/2\"\n" + " },\n" + " {\n" + " action: \"curve\",\n" + " x1: \"w\",\n" + " y1: \"h+h/6\",\n" + " x2: \"0\",\n" + " y2: \"h+h/6\",\n" + " x: \"0\",\n" + " y: \"h/2\"\n" + " },\n" + " {\n" + " action: \"close\"\n" + " }]";
// jo.put("round", JSONArray.parseArray(round));
// String roundRectangle =
// "[{\n" + " action: \"move\",\n" + " x: \"0\",\n" + " y: \"4\"\n" + "},\n" + " {\n" + " action: \"quadraticCurve\",\n" + " x1: \"0\",\n" + " y1: \"0\",\n" + " x: \"4\",\n" + " y: \"0\"\n" + " },\n" + " {\n" + " action: \"line\",\n" + " x: \"w-4\",\n" + " y: \"0\"\n" + " },\n" + " {\n" + " action: \"quadraticCurve\",\n" + " x1: \"w\",\n" + " y1: \"0\",\n" + " x: \"w\",\n" + " y: \"4\"\n" + " },\n" + " {\n" + " action: \"line\",\n" + " x: \"w\",\n" + " y: \"h-4\"\n" + " },\n" + " {\n" + " action: \"quadraticCurve\",\n" + " x1: \"w\",\n"
// + " y1: \"h\",\n" + " x: \"w-4\",\n" + " y: \"h\"\n" + " },\n" + " {\n" + " action: \"line\",\n" + " x: \"4\",\n" + " y: \"h\"\n" + " },\n" + " {\n" + " action: \"quadraticCurve\",\n" + " x1: \"0\",\n" + " y1: \"h\",\n" + " x: \"0\",\n" + " y: \"h-4\"\n" + " },\n" + " {\n" + " action: \"close\"\n" + " }]";
// jo.put("roundRectangle", JSONArray.parseArray(roundRectangle));
// return jo;
// }
//
// /**
// * 获取图元中 图片的 base64 数据
// *
// * @param wsId 资产库id
// * @param methodId 建模方法
// * @param schemaTypeEnum 图元类型枚举
// * @param isCustom 是否自定义
// * @param schemaDataModel 图元数据model
// */
// public static JSONObject getImageBase64InSchemaData(String wsId, String methodId, PalSchemaTypeEnum schemaTypeEnum, boolean isCustom, PalSchemaDataModel schemaDataModel) {
// String iconFileName = "";
// JSONObject jo = new JSONObject();
// String imageId = null;
// String oldImagePath = null;
// JSONArray pathJa = schemaDataModel.getPath();
// if (pathJa != null) {
// for (int i = 0; i < pathJa.size(); i++) {
// JSONObject pathJo = pathJa.getJSONObject(i);
// if (schemaTypeEnum == PalSchemaTypeEnum.CANVAS) {
// if (pathJo.containsKey("iconImage")) {
// JSONObject iconImage = pathJo.getJSONObject("iconImage");
// imageId = iconImage.getString("imageId");
// iconFileName = iconImage.getString("iconFileName");
// break;
// }
// }
// if (schemaTypeEnum == PalSchemaTypeEnum.IMAGE) {
// if (pathJo.containsKey("fillStyle")) {
// JSONObject fillStyle = pathJo.getJSONObject("fillStyle");
// String type = fillStyle.getString("type");
// String fileId = fillStyle.getString("fileId");
// iconFileName = fillStyle.getString("iconFileName");
// if ("imageDef".equals(type) && fileId != null) {
// imageId = fileId;
// break;
// }
// if ("image".equals(type) && fileId != null) {
// oldImagePath = fileId;
// break;
// }
// }
// }
// }
// }
// jo.put("base64", "");
// jo.put("iconFileName", iconFileName);
// if (imageId != null) {
// DCContext imageFileDc = PALWorkSpaceMethodConfigUtil.getMethodConfigDc(wsId, methodId, imageId, isCustom);
// jo.put("imageFilePath", imageFileDc.getFilePath());
// jo.put("base64", CoeDcUtil.dcContextToString(imageFileDc));
// }
// if (oldImagePath != null) {
// // ../apps开头默认为web下目录替换路径
// if (oldImagePath.indexOf("../apps") == 0) {
// oldImagePath = AWSPortalConf.getLocation() + oldImagePath.substring(3);
// }
// File imageFile = new File(oldImagePath.replaceAll("\\.svg$", ".png"));
// try {
// String base64 = CoeDesignerImageUtil.convertCommonImageToBase64(imageFile);
// jo.put("imageFilePath", imageFile.getAbsolutePath());
// jo.put("base64", base64);
// jo.put("iconFileName", imageFile.getName());
// } catch (IOException e) {
// LOGGER.error("文件转换base64失败文件路径{}", imageFile.getPath(), e);
// throw new AWSException("文件转换base64失败");
// }
// }
// return jo;
// }
//
// /**
// * 获取iconColor
// */
// public static String getIconColor(JSONArray iconJa) {
// String iconColor = "51,51,51";
// for (int i = 0; i < iconJa.size(); i++) {
// JSONObject iconJo = iconJa.getJSONObject(i);
// JSONObject lineStyle = iconJo.getJSONObject("lineStyle");
// JSONObject fillStyle = iconJo.getJSONObject("fillStyle");
// if (lineStyle != null) {
// String lineColor = lineStyle.getString("lineColor");
// if (lineColor != null) {
// iconColor = lineColor;
// }
// }
// if (fillStyle != null) {
// String fillColor = fillStyle.getString("color");
// if (fillColor != null) {
// iconColor = fillColor;
// }
// }
// }
// return iconColor;
// }
//
// /**
// * 获取形状是否允许出现复制
// *
// * @param wsId 资产库Id
// * @param methodId 建模方法Id
// * @param shapeName 形状name
// * @return 是否允许出现复制
// */
// public static boolean getSchemaShapeAllowOccurrence(String wsId, String methodId, String shapeName) {
// PALMethodSchemaModel schemaModel = PALMethodSchemaCache.getModelListByMethodIdAndLangAndWsId(methodId, I18nRes.getUserLanguage(), wsId);
// if (schemaModel == null) {
// return false;
// }
// List<PALMethodShapeSchemaModel> shapeSchemaList = schemaModel.getShapeSchemaList();
// for (PALMethodShapeSchemaModel shapeSchema : shapeSchemaList) {
// if (shapeSchema.getKey().equals(shapeName)) {
// return shapeSchema.isAllowOccurrence();
// }
// }
// return false;
// }
//
// /**
// * 获取当前资产库下所有形状定义文件里面的functions定义
// *
// * @param wsId 资产库ID
// * @return 当前资产库下所有形状定义文件里面的functions定义
// */
// public static JSONObject getMethodFunctions(String wsId) {
// List<PALMethodModel> methodList = new ArrayList<>();
// List<String> categories = PALMethodCache.getPALMethodList(true, wsId);
// for (String category : categories) {
// methodList.addAll(PALMethodCache.getPALMethodModelListByMethod(category, wsId));
// }
// // 单独处理泳池泳道和基本形状
// PALMethodModel lane = PALMethodCache.getPALMethodModelById("lane", wsId);
// if (lane != null) {
// methodList.add(lane);
// }
// PALMethodModel basic = PALMethodCache.getPALMethodModelById("basic", wsId);
// if (basic != null) {
// methodList.add(basic);
// }
// List<String> methodIds = methodList.stream().map(PALMethodModel::getMethodId).collect(Collectors.toList());
// // 获取所有的functions
// return getMethodIdsFunctions(wsId, methodIds);
// }
//
// /**
// * 获取当前资产库下建模方法的functions定义
// *
// * @param wsId 资产库ID
// * @param methodIds 建模方法ID集合
// * @return 获取当前资产库下建模方法的functions定义
// */
// public static JSONObject getMethodIdsFunctions(String wsId, List<String> methodIds) {
// JSONObject functionObj = new JSONObject();
// // 获取所有的functions
// for (String methodId : methodIds) {
// PALMethodSchemaModel schemaModel = PALMethodSchemaCache.getModelListByMethodIdAndLangAndWsId(methodId, I18nRes.getUserLanguage(), wsId);
// if (schemaModel == null) {
// continue;
// }
// // 拼接function
// List<PALMethodFunctionSchemaModel> functionSchemaList = schemaModel.getFunctionSchemaList();
// if (CollectionUtils.isNotEmpty(functionSchemaList)) {
// for (PALMethodFunctionSchemaModel functionSchemaModel : functionSchemaList) {
// String content = functionSchemaModel.getContent();
// String key = functionSchemaModel.getKey();
// if (StringUtils.isEmpty(content)) {
// continue;
// }
// content = content.trim();
// // 使用正则表达式提取函数名称
// String functionName = extractFunctionName(key);
// // 转换函数声明格式
// content = transformFunctionDeclaration(content, functionName);
// functionObj.put(functionName, content);
// }
// }
// }
// return functionObj;
// }
//
// /**
// * 转换函数声明格式
// */
// public static String transformFunctionDeclaration(String content, String functionName) {
// // 检查输入是否为空或不以"function"开头
// if (UtilString.isEmpty(content) || UtilString.isEmpty(functionName) || !content.trim().startsWith("function")) {
// return content;
// }
// // 替换函数名称
// return content.replaceFirst("^\\s*function\\s+" + functionName, "function");
// }
//
// /**
// * 使用正则表达式提取函数名称
// */
// private static String extractFunctionName(String key) {
// String regex = "^(\\w+)\\(";
// Pattern pattern = Pattern.compile(regex);
// Matcher matcher = pattern.matcher(key);
// if (matcher.find()) {
// return matcher.group(1);
// }
// return "";
// }
//
// /**
// * 获取图元数据
// */
// public static String getSchemaByMethodIds(boolean isAdmin, String wsId, String methodId, List<String> methodIds) {
// StringBuilder shapes = new StringBuilder();
// PALMethodModel mModel = PALMethodCache.getPALMethodModelByMethodIdAndWsId(methodId, wsId);
//
// // 是否允许用户自定义模板0不允许1允许
// String isCustomDefine = SDK.getAppAPI().getProperty(CoEConstant.APP_ID, CoEConstant.PROPERTY_CUSTOM_DEFINE_SCHEMA);
//
// if (mModel != null) {
// String schema = mModel.getSchema();
// shapes.append(schema).append("\r\n");
// }
// for (String cate : methodIds) {
// if ("basic".equals(cate)) {
// shapes.append(PALMethodCache.getBasicTpl(wsId)).append("\r\n");
// continue;
// }
// if ("lane".equals(cate)) {
// String laneTpl = PALMethodCache.getLaneTpl(wsId);
// shapes.append(laneTpl).append("\r\n");
// continue;
// }
// PALMethodModel methodModel = PALMethodCache.getPALMethodModelByMethodIdAndWsId(cate, wsId);
// if (methodModel == null) {
// continue;
// }
// String schema = methodModel.getSchema();
// if ("0".equals(isCustomDefine)) {
// shapes.append(schema).append("\r\n");
// } else {
// if (isAdmin) {
// shapes.append(schema).append("\r\n");
// } else {
// shapes.append(MethodSchemaConst.SCHEMA_SHAPE.replace("*?", schema)).append("\r\n");
// }
// shapes.append(methodModel.getCustomSchema()).append("\r\n");
// }
// }
// return shapes.toString();
// }
//
// /**
// * 获取图元数据 根据建模方法ID
// */
// public static String getSchemaByMethodId(String wsId, String methodId) {
// PALMethodModel model = PALMethodCache.getPALMethodModelByMethodIdAndWsId(methodId, wsId);
// if (model == null) {
// return "";
// }
// return model.getSchema();
// }
}

View File

@ -14,6 +14,8 @@ import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodModel;
import com.actionsoft.apps.coe.pal.system.logger.CoeLogger;
import com.actionsoft.apps.coe.pal.system.property.CoePropertyUtil;
import com.actionsoft.i18n.I18nRes;
import com.actionsoft.apps.coe.pal.pal.method.model.PALBasicMethodModel;
import com.actionsoft.apps.coe.pal.pal.method.cache.PALBasicMethodCache;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@ -286,4 +288,32 @@ public class PALMethodUtil {
// System.out.println(getShapeDialog("process.epc","basic"));
}
/**
* 获取建模方法的图标
*
* @param methodId
* @return
*/
public static JSONObject getPALMethodIconById(String methodId, String wsId) {
String code = "";
String color = "";
if ("default".equals(methodId)) {// 默认文件夹
code = "&#xe621;";
color = "#FFB718";
} else {
PALBasicMethodModel model = PALBasicMethodCache.getModelByMethodIdAndWsId(methodId, wsId);
if (model == null) {
code = "&#xe621;";
color = "#FFB718";
} else {
code = model.getIconCode();
color = model.getIconColor();
}
}
JSONObject result = new JSONObject();
result.put("code", code);
result.put("color", color);
return result;
}
}

View File

@ -0,0 +1,68 @@
package com.actionsoft.apps.coe.pal.pal.processexec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.actionsoft.apps.coe.pal.pal.processexec.constant.B2PControlModeEnum;
import com.actionsoft.apps.coe.pal.pal.processexec.constant.P2BControlModeEnum;
import com.actionsoft.apps.coe.pal.pal.repository.cache.CoeProcessLevelCorrelateCache;
import com.actionsoft.apps.coe.pal.pal.repository.model.CoeProcessLevelCorrelateModel;
/**
* @author oYang
* @Description 梳理到执行关联管理 业务逻辑处理
* @createTime 2024年09月10日 14:34:00
*/
public class ProcessExecAPIManager {
private static final Logger log = LoggerFactory.getLogger(ProcessExecAPIManager.class);
private ProcessExecAPIManager() {
}
public static ProcessExecAPIManager getInstance() {
return SingletonHolder.INSTANCE;
}
/**
* 梳理到执行 流程层面 判断是否有控制权限根据应用参数判定
*
* @param plId PAL端流程ID
* @return boolean
*/
public boolean hasProcessControlPerm(String plId) {
return hasProcessControlPerm(plId, true);
}
private static class SingletonHolder {
private static final ProcessExecAPIManager INSTANCE = new ProcessExecAPIManager();
}
/**
* 梳理到执行 流程层面 判断是否有控制权限根据应用参数判定
*
* @param plId PAL端流程ID
* @return boolean
*/
public boolean hasProcessControlPerm(String plId, boolean isPal) {
boolean hasPerm = true;
CoeProcessLevelCorrelateModel correlateModel = CoeProcessLevelCorrelateCache.getCache().get(plId);
if (correlateModel != null) {
int correlateType = correlateModel.getCorrelateType();
int controlMode = correlateModel.getControlMode();
if (correlateType == 1) {
P2BControlModeEnum controlModeEnum = P2BControlModeEnum.getByValue(controlMode);
if (controlModeEnum != null) {
return isPal ? controlModeEnum.getPalProcessHasPerm() : controlModeEnum.getBpmProcessHasPerm();
}
} else {
B2PControlModeEnum controlModeEnum = B2PControlModeEnum.getByValue(controlMode);
if (controlModeEnum != null) {
return isPal ? controlModeEnum.getPalProcessHasPerm() : controlModeEnum.getBpmProcessHasPerm();
}
}
}
return hasPerm;
}
}

View File

@ -0,0 +1,85 @@
package com.actionsoft.apps.coe.pal.pal.processexec.constant;
/**
* @author oYang
* @Description BPM推送PAL 流程控制模式
* @createTime 2024年09月20日 15:15:00
*/
public enum B2PControlModeEnum {
/**
* 以PAL为中心+BPM图结构只读
*/
PAL_BPM_READ_ONLY(1, "以PAL为中心+BPM图结构只读", false, false, true, true),
/**
* 以PAL为中心+BPM图可编辑
*/
PAL_BPM_EDIT(2, "以PAL为中心+BPM图可编辑", false, true, true, true),
/**
* 以BPM为中心+PAL图结构只读
*/
BPM_PAL_READ_ONLY(3, "以BPM为中心+PAL图结构只读", true, true, false, false),
/**
* 以BPM为中心+PAL图结构可编辑
*/
BPM_PAL_EDIT(4, "以BPM为中心+PAL图结构可编辑", true, true, false, true),
/**
* 不限制
*/
NONE(5, "不限制", true, true, true, true);
private final Integer value;
private final String desc;
private final Boolean bpmProcessHasPerm; // BPM流程层面控制权限
private final Boolean bpmProcessDiagramHasPerm; // BPM流程图结构控制权限
private final Boolean palProcessHasPerm; // PAL流程层面控制权限
private final Boolean palProcessDiagramHasPerm; // PAL流程图结构控制权限
B2PControlModeEnum(Integer value, String desc, Boolean bpmProcessHasPerm, Boolean bpmProcessDiagramHasPerm, Boolean palProcessHasPerm, Boolean palProcessDiagramHasPerm) {
this.value = value;
this.desc = desc;
this.bpmProcessHasPerm = bpmProcessHasPerm;
this.bpmProcessDiagramHasPerm = bpmProcessDiagramHasPerm;
this.palProcessHasPerm = palProcessHasPerm;
this.palProcessDiagramHasPerm = palProcessDiagramHasPerm;
}
public static B2PControlModeEnum getByValue(Integer value) {
for (B2PControlModeEnum mode : values()) {
if (mode.getValue().equals(value)) {
return mode;
}
}
return null;
}
public Integer getValue() {
return value;
}
public String getDesc() {
return desc;
}
public Boolean getBpmProcessHasPerm() {
return bpmProcessHasPerm;
}
public Boolean getBpmProcessDiagramHasPerm() {
return bpmProcessDiagramHasPerm;
}
public Boolean getPalProcessHasPerm() {
return palProcessHasPerm;
}
public Boolean getPalProcessDiagramHasPerm() {
return palProcessDiagramHasPerm;
}
}

View File

@ -0,0 +1,83 @@
package com.actionsoft.apps.coe.pal.pal.processexec.constant;
/**
* @author oYang
* @Description PAL端推送BPM端的流程控制模式
* @createTime 2024年09月20日 14:55:00
*/
public enum P2BControlModeEnum {
/**
* 以PAL为中心+BPM图结构只读
*/
PAL_BPM_READ_ONLY(1, "以PAL为中心+BPM图结构只读", false, false, true, true),
/**
* 以PAL为中心+BPM图可编辑
*/
PAL_BPM_EDIT(2, "以PAL为中心+BPM图可编辑", false, true, true, true),
/**
* 以BPM为中心+PAL图结构只读
*/
BPM_PAL_READ_ONLY(3, "以BPM为中心+PAL图结构只读", true, true, false, false),
/**
* 以BPM为中心+PAL图结构可编辑
*/
BPM_PAL_EDIT(4, "以BPM为中心+PAL图结构可编辑", true, true, false, true),
/**
* 不限制
*/
NONE(5, "不限制", true, true, true, true);
private final Integer value;
private final String desc;
private final Boolean bpmProcessHasPerm; // BPM流程层面控制权限
private final Boolean bpmProcessDiagramHasPerm; // BPM流程图结构控制权限
private final Boolean palProcessHasPerm; // PAL流程层面控制权限
private final Boolean palProcessDiagramHasPerm; // PAL流程图结构控制权限
P2BControlModeEnum(Integer value, String desc, Boolean bpmProcessHasPerm, Boolean bpmProcessDiagramHasPerm, Boolean palProcessHasPerm, Boolean palProcessDiagramHasPerm) {
this.value = value;
this.desc = desc;
this.bpmProcessHasPerm = bpmProcessHasPerm;
this.bpmProcessDiagramHasPerm = bpmProcessDiagramHasPerm;
this.palProcessHasPerm = palProcessHasPerm;
this.palProcessDiagramHasPerm = palProcessDiagramHasPerm;
}
public static P2BControlModeEnum getByValue(Integer value) {
for (P2BControlModeEnum mode : values()) {
if (mode.getValue().equals(value)) {
return mode;
}
}
return null;
}
public Integer getValue() {
return value;
}
public String getDesc() {
return desc;
}
public Boolean getBpmProcessHasPerm() {
return bpmProcessHasPerm;
}
public Boolean getBpmProcessDiagramHasPerm() {
return bpmProcessDiagramHasPerm;
}
public Boolean getPalProcessHasPerm() {
return palProcessHasPerm;
}
public Boolean getPalProcessDiagramHasPerm() {
return palProcessDiagramHasPerm;
}
}

View File

@ -2,6 +2,8 @@ package com.actionsoft.apps.coe.pal.pal.repository.designer;
import java.io.File;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.actionsoft.apps.coe.pal.pal.manage.util.PalManageUtil;
import com.actionsoft.bpms.bpmn.engine.cache.ProcessDefCache;
@ -1431,5 +1433,15 @@ public class CoeDesignerShapeAPIManager {
}
return jsVal;
}
/**
* 获取所有已排序的有效且使用中的形状属性
*
* @param wsId 资产库ID
* @param methodId 建模方法ID
* @return key attrKey value PALMethodAttributeModel
*/
public Map<String, PALMethodAttributeModel> getAllValidAndUseShapeAttributeModelsMap(String wsId, String methodId) {
return getAllValidAndUseShapeAttributeModels(wsId, methodId).stream().collect(Collectors.toMap(PALMethodAttributeModel::getKey, Function.identity()));
}
}

View File

@ -96,5 +96,9 @@ public class CoeDesignerConstant {
public final static int ADAPTER_DESGINER_PROCESS = 1;
public final static int REALTIME_LISTEN_TIME = 30;
/**
* 版本对比页面
*/
public final static String DESIGNER_VERSION_COMPARE_PAGE = "pal.pl.repository.designer.graph.versionCompare.htm";
}

View File

@ -0,0 +1,59 @@
package com.actionsoft.apps.coe.pal.pal.repository.designer.constant;
/**
* @author oYang
* @Description 节点变化类型连线只有新增
* @createTime 2024年08月07日 11:47:00
*/
public enum DiffNodeTypeEnum {
/**
* 新增
*/
ADD("add", "新增"),
/**
* 删除
*/
DELETE("delete", "删除"),
/**
* 位置
*/
POSITION("position", "位置"),
/**
* 信息
*/
INFO("info", "信息"),
/**
* 样式
*/
STYLE("style", "样式");
private final String code;
private final String desc;
DiffNodeTypeEnum(String code, String desc) {
this.code = code;
this.desc = desc;
}
public static DiffNodeTypeEnum getByCode(String code) {
for (DiffNodeTypeEnum type : DiffNodeTypeEnum.values()) {
if (type.getCode().equals(code)) {
return type;
}
}
return null;
}
public String getCode() {
return code;
}
public String getDesc() {
return desc;
}
}

View File

@ -0,0 +1,52 @@
package com.actionsoft.apps.coe.pal.pal.repository.designer.constant;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import com.actionsoft.bpms.util.UtilString;
/**
* @author oYang
* @Description 版本状态枚举
* @createTime 2024年07月29日 14:51:00
*/
public enum VersionStatusEnum {
USE("use", "设计中"), PUBLISH("publish", "已发布"), STOP("stop", "已停用"), APPROVAL("approval", "审核中"), DESIGNER("designer", "设计");
private static final Map<String, VersionStatusEnum> codeToStatus = new HashMap<>();
static {
for (VersionStatusEnum status : VersionStatusEnum.values()) {
codeToStatus.put(status.code, status);
}
}
String code;
String desc;
VersionStatusEnum(String code, String desc) {
if (UtilString.isEmpty(code) || UtilString.isEmpty(desc)) {
throw new IllegalArgumentException("Code and Desc must not be null");
}
this.code = code;
this.desc = desc;
}
public static Optional<VersionStatusEnum> getByCode(String code) {
if (UtilString.isEmpty(code)) {
throw new IllegalArgumentException("Code must not be null");
}
VersionStatusEnum status = codeToStatus.get(code);
return Optional.ofNullable(status);
}
public String getCode() {
return code;
}
public String getDesc() {
return desc;
}
}

View File

@ -0,0 +1,56 @@
package com.actionsoft.apps.coe.pal.pal.repository.designer.dto;
/**
* @author oYang
* @Description 版本对比参数
* @createTime 2024年08月02日 11:43:00
*/
public class VersionCompareDTO {
private String wsId;
private String teamId;
private String compareVerId;
private String curId;
public VersionCompareDTO() {
}
public VersionCompareDTO(String wsId, String teamId, String compareVerId, String curId) {
this.wsId = wsId;
this.teamId = teamId;
this.compareVerId = compareVerId;
this.curId = curId;
}
public String getWsId() {
return wsId;
}
public void setWsId(String wsId) {
this.wsId = wsId;
}
public String getTeamId() {
return teamId;
}
public void setTeamId(String teamId) {
this.teamId = teamId;
}
public String getCompareVerId() {
return compareVerId;
}
public void setCompareVerId(String compareVerId) {
this.compareVerId = compareVerId;
}
public String getCurId() {
return curId;
}
public void setCurId(String curId) {
this.curId = curId;
}
}

View File

@ -0,0 +1,46 @@
package com.actionsoft.apps.coe.pal.pal.repository.designer.dto;
/**
* @author oYang
* @Description 版本列表
* @createTime 2024年07月29日 11:12:00
*/
public class VersionListDTO {
private String wsId;
private String teamId;
private String id;
public VersionListDTO() {
}
public VersionListDTO(String wsId, String teamId, String id) {
this.wsId = wsId;
this.teamId = teamId;
this.id = id;
}
public String getWsId() {
return wsId;
}
public void setWsId(String wsId) {
this.wsId = wsId;
}
public String getTeamId() {
return teamId;
}
public void setTeamId(String teamId) {
this.teamId = teamId;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}

View File

@ -0,0 +1,411 @@
package com.actionsoft.apps.coe.pal.pal.repository.designer.image.util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.batik.ext.awt.image.codec.imageio.ImageIOJPEGImageWriter;
import org.apache.batik.ext.awt.image.spi.ImageWriterRegistry;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.JPEGTranscoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.designer.constant.CoeDesignerConstant;
//import com.actionsoft.apps.coe.pal.pal.repository.designer.image.dao.CoeUserShapeImageDao;
//import com.actionsoft.apps.coe.pal.pal.repository.designer.image.model.CoeUserShapeImageModel;
//import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerDcUtil;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.apps.coe.pal.util.CoeDcUtil;
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
import com.actionsoft.bpms.server.fs.DCContext;
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
import com.actionsoft.bpms.server.fs.dc.DCUtil;
import com.actionsoft.bpms.util.UtilFile;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.exception.AWSException;
import com.actionsoft.i18n.I18nRes;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
/**
* 设计器图片处理工具类
*/
public class CoeDesignerImageUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(CoeDesignerImageUtil.class);
/**
* 图片正则校验
*/
public static final String imgReg = ".*\\.(jpg|jpeg|png|gif|svg|tiff|bmp)$";
// /**
// * 获取前端上传DC的临时目录
// *
// * @param userId 用户id
// */
// public static DCContext getTmpShapeImageDc(String userId) {
// return DCUtil.createTempFileContext(CoEConstant.APP_ID, CoeDesignerConstant.DESIGNER_SHAPE_IMAGES, userId, null);
// }
//
// /**
// * 获取 形状图片数据 名称内容数据 <br/>
// * 即keyimageId, value图片的base64 数据
// *
// * @param wsId 资产库id
// * @param uuid 模型id
// */
// public static JSONObject getImageBase64Jo(String wsId, String uuid) {
// DCContext defineDc = CoeDesignerDcUtil.getDefineDc(wsId, uuid);
// return getImageBase64JoByPlDc(defineDc);
// }
//
// /**
// * 获取 形状图片数据 名称内容数据 <br/>
// * 即keyimageId, value图片的base64 数据
// *
// * @param dcContext 模型文件所在的DC对象
// */
// public static JSONObject getImageBase64JoByPlDc(DCContext dcContext) {
// JSONObject result = new JSONObject();
// if (dcContext == null) {
// return result;
// }
// dcContext.setFileName(CoeDesignerConstant.PL_IMAGE_FILE_NAME);
// if (dcContext.existFile()) {
// JSONArray array = CoeDcUtil.dcContextToJa(dcContext);
// for (int i = 0; i < array.size(); i++) {
// String name = array.getString(i);
// if (name.contains(".")) {
// continue;
// }
// dcContext.setFileName(name);
// String base64 = CoeDcUtil.dcContextToString(dcContext);
// result.put(name, base64);
// }
// }
// return result;
// }
//
// /**
// * 处理 形状图片文件夹 shapeimages
// */
// public static void handleShapeImagesByDefine(JSONObject definition, PALRepositoryModel plModel, boolean isCustom) {
// // 获取形状 json中 形状图片 fileId 内容集合
// List<String> shapeImageList = new ArrayList<>();
// JSONObject elements = definition.getJSONObject("elements");
// for (String key : elements.keySet()) {
// JSONObject shape = elements.getJSONObject(key);
// // 统计形状文件id
// if (shape.containsKey("fillStyle")) {
// JSONObject fillStyle = shape.getJSONObject("fillStyle");
// String fileId = fillStyle.getString("fileId");
// if (fileId != null) {
// shapeImageList.add(fileId);
// }
// }
// if (shape.containsKey("path")) {
// JSONArray pathJa = shape.getJSONArray("path");
// for (int i = 0; i < pathJa.size(); i++) {
// JSONObject path = pathJa.getJSONObject(i);
// if (path.containsKey("fillStyle")) {
// JSONObject fillStyle = path.getJSONObject("fillStyle");
// String fileId = fillStyle.getString("fileId");
// if (fileId != null) {
// shapeImageList.add(fileId);
// }
// }
// if (path.containsKey("iconImage")) {
// JSONObject iconImage = path.getJSONObject("iconImage");
// String imageId = iconImage.getString("imageId");
// if (imageId != null) {
// shapeImageList.add(imageId);
// }
// }
// }
// }
// }
// // 生成并复制图片定义中的图片 并删除冗余文件
// CoeDesignerImageDefUtil.generateAndCopyImageDef(shapeImageList, plModel.getWsId(), plModel.getMethodId(), plModel.getId(), isCustom);
// }
//
// /**
// * 组装 define 数据 fillStyle和path 中添加 base64数据
// */
// public static String wrapperShapeImagesIntoDefine(String define, PALRepositoryModel plModel) {
// JSONObject imageBase64Jo = CoeDesignerImageUtil.getImageBase64Jo(plModel.getWsId(), plModel.getId());
// return wrapperShapeImagesIntoDefine(define, imageBase64Jo);
// }
//
// /**
// * 组装 define 数据 fillStyle和path 中添加 base64数据
// */
// public static String wrapperShapeImagesIntoDefine(String define, JSONObject imageBase64Jo) {
// if (UtilString.isEmpty(define) || imageBase64Jo == null || imageBase64Jo.isEmpty()) {
// return define;
// }
// JSONObject definition = JSONObject.parseObject(define);
// JSONObject elements = definition.getJSONObject("elements");
// for (String key : elements.keySet()) {
// JSONObject shape = elements.getJSONObject(key);
// JSONObject fillStyle = shape.getJSONObject("fillStyle");
// if (fillStyle != null) {
// // 数据为paste的来源
// String fileId = fillStyle.getString("fileId");
// String from = fillStyle.getString("from");
// // 存在 fileId from
// if (fileId != null && from != null) {
// if (imageBase64Jo.containsKey(fileId)) {
// fillStyle.put("base64", imageBase64Jo.getString(fileId));
// } else {
// LOGGER.error("图片生成处理,填充图片错误[错误]图片ID{}", fileId);
// }
// }
// }
// JSONArray pathJa = shape.getJSONArray("path");
// if (pathJa != null) {
// for (int i = 0; i < pathJa.size(); i++) {
// JSONObject path = pathJa.getJSONObject(i);
// JSONObject pathFileStyle = path.getJSONObject("fillStyle");
// if (pathFileStyle != null) {
// String fileId = pathFileStyle.getString("fileId");
// if (fileId != null) {
// if (imageBase64Jo.containsKey(fileId)) {
// pathFileStyle.put("base64", imageBase64Jo.getString(fileId));
// } else {
// LOGGER.error("图片生成处理填充图元icon错误[错误]图片ID{}", fileId);
// }
// }
// }
// }
// }
// }
// return definition.toJSONString();
// }
//
// /**
// * 将base64转换为bytes数据
// *
// * @param base64String 图片image
// * @return base64数据
// */
// public static byte[] convertBase64ToBytes(String base64String) {
// // 组装参数
// try {
// // 去掉"data:image/png;base64,"前缀
// String[] baseSplit = base64String.split(",");
// String base64Data;
// String imageType = "png";
// // 定义正则表达式
// String regex = "data:image\\/([^;]+);base64";
// if (baseSplit.length > 1) {
// // 获取图片类型
// base64Data = baseSplit[1];
// // 编译正则表达式
// Pattern pattern = Pattern.compile(regex);
// // 创建匹配器
// Matcher matcher = pattern.matcher(baseSplit[0]);
// // 使用非贪婪匹配
// if (matcher.find()) {
// imageType = matcher.group(1);
// // 处理svg类型
// if ("svg+xml".equalsIgnoreCase(imageType)) {
// imageType = "svg";
// }
// }
// } else {
// base64Data = baseSplit[0];
// }
// byte[] bytes = Base64.getDecoder().decode(base64Data);
// if ("svg".equals(imageType)) {
// String base64Str = svgBytesToBase64(bytes);
// base64Str = base64Str.replaceAll("\r?\n", "");
// bytes = Base64.getDecoder().decode(base64Str);
// // 存入携带前缀的base64数据
// }
// return bytes;
// } catch (TranscoderException e) {
// throw new AWSException(I18nRes.findValue(CoEConstant.APP_ID, "base64数据存储错误"), e);
// }
// }
//
// /**
// * 将图片转存储为base64 PNG + base64 存储两个文件且删除原文件
// *
// * @param imageFileDc 图片文件
// */
// public static String dumpImageToBase64(DCContext imageFileDc) {
// try {
// String fileName = imageFileDc.getFileName();
// if (!imageFileDc.existFile() || !fileName.contains(".")) {
// return "";
// }
// // 获取无后缀的路径
// int i = fileName.lastIndexOf(".");
// String sFileName = fileName.substring(0, i);
// String base64String;
// if (fileName.endsWith(".svg")) {
// base64String = convertSvgToBase64(imageFileDc);
// } else {
// base64String = convertCommonImageToBase64(imageFileDc);
// }
// if (!fileName.matches(".png$")) {
// // 删除原本文件
// imageFileDc.delete();
// // 将base64转为png存储
// imageFileDc.setFileName(sFileName + ".png");
// SDK.getDCAPI().write(base64StringToInputStream(base64String), imageFileDc);
// }
// // 将base64直接存入文件
// DCContext cloneImageFileDc = imageFileDc.clone();
// cloneImageFileDc.setFileName(sFileName);
// base64String = base64String.replaceAll("\\s", "+");
// CoeDcUtil.write(base64String, cloneImageFileDc);
// return base64String;
// } catch (IOException e) {
// throw new AWSException(I18nRes.findValue(CoEConstant.APP_ID, "图片存储失败"));
// }
// }
/**
* 常规图片转base64
*/
public static String convertCommonImageToBase64(DCContext imageFileDc) throws IOException {
byte[] bytes = CoeDcUtil.dcContextToByte(imageFileDc);
return "data:image/png;base64," + Base64.getEncoder().encodeToString(bytes);
}
/**
* 常规图片转base64
*/
public static String convertCommonImageToBase64(File imageFile) throws IOException {
byte[] imageBytes = Files.readAllBytes(imageFile.toPath());
return "data:image/png;base64," + Base64.getEncoder().encodeToString(imageBytes);
}
// /**
// * 转换svg图片为base64
// */
// private static String convertSvgToBase64(DCContext imageFileDc) {
// byte[] bytes = CoeDcUtil.dcContextToByte(imageFileDc);
// try {
// String base64Str = svgBytesToBase64(bytes);
// base64Str = base64Str.replaceAll("\r?\n", "");
// return "data:image/png;base64," + base64Str;
// } catch (Exception e) {
// throw new AWSException(I18nRes.findValue(CoEConstant.APP_ID, "转换svg文件发生错误"), e);
// }
// }
//
// /**
// * svg 二进制数据 转换为 base64 数据
// */
// private static String svgBytesToBase64(byte[] bytes) throws TranscoderException {
// String decodedSvg = new String(bytes, StandardCharsets.UTF_8);
// if (decodedSvg.contains("href=\"")) {
// String substring = decodedSvg.substring(decodedSvg.indexOf("href=\"") + 6, decodedSvg.lastIndexOf("\""));
// if (substring.split("\\.").length > 1) {
// return substring.split("\\.")[1];
// } else {
// return substring;
// }
// } else if (!decodedSvg.contains("<svg")) {
// return Base64.getEncoder().encodeToString(bytes);
// } else {
// ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
// ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
// TranscoderInput input = new TranscoderInput(inputStream);
// TranscoderOutput output = new TranscoderOutput(outputStream);
// JPEGTranscoder transcoder = new JPEGTranscoder();
// // JPEG实现 注册
// ImageWriterRegistry.getInstance().register(new ImageIOJPEGImageWriter());
// transcoder.transcode(input, output);
// byte[] pngBytes = outputStream.toByteArray();
// return Base64.getEncoder().encodeToString(pngBytes);
// }
// }
//
// /**
// * 获取DC shapeimages imageId 路径 <br/>
// * DC/shapeimages/userId/imageId/
// */
// public static DCContext getCommonShapeImageDc(String userId, String imageId, String fileName) {
// DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeDesignerConstant.DESIGNER_SHAPE_IMAGES);
// return new DCContext(null, dcProfile, CoEConstant.APP_ID, userId, imageId, fileName);
// }
//
// /**
// * 依据用户删除文件目录
// */
// public static void deleteDirByUserId(String userId) {
// List<CoeUserShapeImageModel> imageModels = new CoeUserShapeImageDao().queryListByUserId(userId);
// for (CoeUserShapeImageModel imageModel : imageModels) {
// DCContext commonShapeImageDc = getCommonShapeImageDc(userId, imageModel.getImageId(), imageModel.getFileName());
// commonShapeImageDc.delete();
// }
// }
//
// /**
// * 获取图片base64内容并转换为 InputStream 对象
// */
// @Deprecated
// public static InputStream getShapeImagesIS(String filePath) {
// UtilFile file = new UtilFile(filePath);
// if (file.exists()) {
// if (!file.getName().contains(".")) {
// String base64String = file.readStrUTF8();
// String base64Data = base64String.substring(base64String.indexOf(",") + 1);
// base64Data = base64Data.replaceAll("\\s", "+");
// byte[] bytes = Base64.getDecoder().decode(base64Data);
// return new ByteArrayInputStream(bytes);
// }
// }
// return null;
// }
//
// /**
// * 获取图片base64内容并转换为 InputStream 对象
// */
// public static InputStream getShapeImagesIS(String plId, String imageId) {
// PALRepositoryModel plModel = PALRepositoryCache.getCache().get(plId);
// if (plModel != null) {
// DCContext dcContext = CoeDesignerDcUtil.getDefineDc(plModel.getWsId(), plModel.getId());
// dcContext.setFileName(imageId);
// if (dcContext.existFile()) {
// return base64StringToInputStream(CoeDcUtil.dcContextToString(dcContext));
// }
// }
// return null;
// }
//
// /**
// * Base64 编码的字符串转换为 InputStream
// *
// * @param base64String Base64 编码的字符串
// * @return 转换后的 InputStream
// */
// public static InputStream base64StringToInputStream(String base64String) {
// if (UtilString.isEmpty(base64String)) {
// return null;
// }
// // 解码 Base64 字符串为字节数组
// byte[] bytes = Base64.getDecoder().decode(base64String.replace("data:image/png;base64,", ""));
// // 创建 ByteArrayInputStream
// return new ByteArrayInputStream(bytes);
// }
}

View File

@ -0,0 +1,115 @@
package com.actionsoft.apps.coe.pal.pal.repository.designer.vo;
import com.alibaba.fastjson.annotation.JSONField;
/**
* @author oYang
* @Description 形状属性VO
* @createTime 2024年08月02日 17:51:00
*/
public class AttrVO {
private final String id; // 属性id
private final String name; // 属性名称
private final Object value; // 属性值
private final String type; // 属性类型
private final Boolean isDiff; // 是否有差异
private final Object compareAccord; // 对比依据
private final Integer orderIndex; // 用于排序
private AttrVO(Builder builder) {
this.id = builder.id;
this.name = builder.name;
this.value = builder.value;
this.type = builder.type;
this.isDiff = builder.isDiff;
this.compareAccord = builder.compareAccord;
this.orderIndex = builder.orderIndex;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public Object getValue() {
return value;
}
public String getType() {
return type;
}
public Boolean getIsDiff() {
return isDiff;
}
// @JSONField(serialize = false)
public Object getCompareAccord() {
return compareAccord;
}
@JSONField(serialize = false)
public Integer getOrderIndex() {
return orderIndex;
}
public static final class Builder {
private String id;
private String name;
private Object value;
private String type;
private Boolean isDiff;
private Object compareAccord;
private Integer orderIndex;
private Builder() {
}
public static Builder createBuilder() {
return new Builder();
}
public Builder withId(String id) {
this.id = id;
return this;
}
public Builder withName(String name) {
this.name = name;
return this;
}
public Builder withValue(Object value) {
this.value = value;
return this;
}
public Builder withType(String type) {
this.type = type;
return this;
}
public Builder withIsDiff(Boolean isDiff) {
this.isDiff = isDiff;
return this;
}
public Builder withCompareAccord(Object compareAccord) {
this.compareAccord = compareAccord;
return this;
}
public Builder withOrderIndex(Integer orderIndex) {
this.orderIndex = orderIndex;
return this;
}
public AttrVO build() {
return new AttrVO(this);
}
}
}

View File

@ -0,0 +1,53 @@
package com.actionsoft.apps.coe.pal.pal.repository.designer.vo;
import java.util.List;
/**
* @author oYang
* @Description 节点及连线对比
* @createTime 2024年08月07日 13:45:00
*/
public class DiffNodeVO {
private final String id; // 节点id或者连线id
private final List<String> type; // 节点或者连线变化类型多个连线只有新增
private DiffNodeVO(Builder builder) {
this.id = builder.id;
this.type = builder.type;
}
public String getId() {
return id;
}
public List<String> getType() {
return type;
}
public static final class Builder {
private String id;
private List<String> type;
private Builder() {
}
public static Builder create() {
return new Builder();
}
public Builder withId(String id) {
this.id = id;
return this;
}
public Builder withType(List<String> type) {
this.type = type;
return this;
}
public DiffNodeVO build() {
return new DiffNodeVO(this);
}
}
}

View File

@ -0,0 +1,111 @@
package com.actionsoft.apps.coe.pal.pal.repository.designer.vo;
/**
* @author oYang
* @Description 形状链接
* @createTime 2024年08月05日 15:08:00
*/
public class ShapeLinkVO {
private final String name;
private final String target;
private final String type;
private final String url;
private final String uuid;
private final String value;
private final String versionId;
public ShapeLinkVO(Builder builder) {
this.name = builder.name;
this.target = builder.target;
this.type = builder.type;
this.url = builder.url;
this.uuid = builder.uuid;
this.value = builder.value;
this.versionId = builder.versionId;
}
public String getName() {
return name;
}
public String getTarget() {
return target;
}
public String getType() {
return type;
}
public String getUrl() {
return url;
}
public String getUuid() {
return uuid;
}
public String getValue() {
return value;
}
public String getVersionId() {
return versionId;
}
public static final class Builder {
private String name;
private String target;
private String type;
private String url;
private String uuid;
private String value;
private String versionId;
private Builder() {
}
public static Builder createBuilder() {
return new Builder();
}
public Builder withName(String name) {
this.name = name;
return this;
}
public Builder withTarget(String target) {
this.target = target;
return this;
}
public Builder withType(String type) {
this.type = type;
return this;
}
public Builder withUrl(String url) {
this.url = url;
return this;
}
public Builder withUuid(String uuid) {
this.uuid = uuid;
return this;
}
public Builder withValue(String value) {
this.value = value;
return this;
}
public Builder withVersionId(String versionId) {
this.versionId = versionId;
return this;
}
public ShapeLinkVO build() {
return new ShapeLinkVO(this);
}
}
}

View File

@ -0,0 +1,75 @@
package com.actionsoft.apps.coe.pal.pal.repository.designer.vo;
/**
* @author oYang
* @Description 形状附件
* @createTime 2024年08月05日 11:27:00
*/
public class UpFileVO {
private final String fileId;
private final String fileName;
private final String downloadUrl;
private final Boolean hasSecurity;
private UpFileVO(Builder builder) {
this.fileId = builder.fileId;
this.fileName = builder.fileName;
this.downloadUrl = builder.downloadUrl;
this.hasSecurity = builder.hasSecurity;
}
public String getFileId() {
return fileId;
}
public String getFileName() {
return fileName;
}
public String getDownloadUrl() {
return downloadUrl;
}
public Boolean getHasSecurity() {
return hasSecurity;
}
public static final class Builder {
private String fileId;
private String fileName;
private String downloadUrl;
private Boolean hasSecurity;
private Builder() {
}
public static Builder createBuilder() {
return new Builder();
}
public Builder withFileId(String fileId) {
this.fileId = fileId;
return this;
}
public Builder withFileName(String fileName) {
this.fileName = fileName;
return this;
}
public Builder withDownloadUrl(String downloadUrl) {
this.downloadUrl = downloadUrl;
return this;
}
public Builder withHasSecurity(Boolean hasSecurity) {
this.hasSecurity = hasSecurity;
return this;
}
public UpFileVO build() {
return new UpFileVO(this);
}
}
}

View File

@ -0,0 +1,150 @@
package com.actionsoft.apps.coe.pal.pal.repository.designer.vo;
import java.sql.Timestamp;
/**
* @author oYang
* @Description 版本列表
* @createTime 2024年07月29日 11:47:00
*/
public class VersionListVO {
private final String plId;
private final String versionId;
private final String versionNo;
private final String versionStatus;
private final String createUser;
private final String createTime;
private final String updateUser;
private final String updateTime;
private final Boolean hasCreatePerm; // 是否有创建权限
private final Timestamp correlateTime;
private VersionListVO(VersionListBuilder builder) {
this.plId = builder.plId;
this.versionId = builder.versionId;
this.versionNo = builder.versionNo;
this.versionStatus = builder.versionStatus;
this.createUser = builder.createUser;
this.createTime = builder.createTime;
this.updateUser = builder.updateUser;
this.updateTime = builder.updateTime;
this.hasCreatePerm = builder.hasCreatePerm;
this.correlateTime = builder.correlateTime;
}
public String getPlId() {
return plId;
}
public String getVersionId() {
return versionId;
}
public String getVersionNo() {
return versionNo;
}
public String getVersionStatus() {
return versionStatus;
}
public String getCreateUser() {
return createUser;
}
public String getCreateTime() {
return createTime;
}
public String getUpdateUser() {
return updateUser;
}
public String getUpdateTime() {
return updateTime;
}
public Boolean getHasCreatePerm() {
return hasCreatePerm;
}
public Timestamp getCorrelateTime() {
return correlateTime;
}
public static final class VersionListBuilder {
private String plId;
private String versionId;
private String versionNo;
private String versionStatus;
private String createUser;
private String createTime;
private String updateUser;
private String updateTime;
private Boolean hasCreatePerm;
private Timestamp correlateTime;
private VersionListBuilder() {
}
public static VersionListBuilder createBuilder() {
return new VersionListBuilder();
}
public VersionListBuilder withPlId(String plId) {
this.plId = plId;
return this;
}
public VersionListBuilder withVersionId(String versionId) {
this.versionId = versionId;
return this;
}
public VersionListBuilder withVersionNo(String versionNo) {
this.versionNo = versionNo;
return this;
}
public VersionListBuilder withVersionStatus(String versionStatus) {
this.versionStatus = versionStatus;
return this;
}
public VersionListBuilder withCreateUser(String createUser) {
this.createUser = createUser;
return this;
}
public VersionListBuilder withCreateTime(String createTime) {
this.createTime = createTime;
return this;
}
public VersionListBuilder withUpdateUser(String updateUser) {
this.updateUser = updateUser;
return this;
}
public VersionListBuilder withUpdateTime(String updateTime) {
this.updateTime = updateTime;
return this;
}
public VersionListBuilder withHasCreatePerm(Boolean hasCreatePerm) {
this.hasCreatePerm = hasCreatePerm;
return this;
}
public VersionListBuilder withCorrelateTime(Timestamp correlateTime) {
this.correlateTime = correlateTime;
return this;
}
public VersionListVO build() {
return new VersionListVO(this);
}
}
}

View File

@ -0,0 +1,123 @@
package com.actionsoft.apps.coe.pal.pal.repository.designer.web;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
import com.actionsoft.apps.coe.pal.pal.repository.cache.CoeProcessLevelCorrelateCache;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.designer.constant.CoeDesignerConstant;
import com.actionsoft.apps.coe.pal.pal.repository.designer.dto.VersionCompareDTO;
import com.actionsoft.apps.coe.pal.pal.repository.designer.dto.VersionListDTO;
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.DesignerVersionUtil;
import com.actionsoft.apps.coe.pal.pal.repository.designer.vo.VersionListVO;
import com.actionsoft.apps.coe.pal.pal.repository.model.CoeProcessLevelCorrelateModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.bpms.bpmn.engine.cache.ProcessDefCache;
import com.actionsoft.bpms.bpmn.engine.model.def.ProcessDefinition;
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.exception.AWSException;
import com.actionsoft.i18n.I18nRes;
import com.alibaba.fastjson.JSONObject;
/**
* 设计器流程版本对比 web层
*/
public class CoeDesignerVersionWeb extends ActionWeb {
private static final Logger LOGGER = LoggerFactory.getLogger(CoeDesignerVersionWeb.class);
private final UserContext uc;
public CoeDesignerVersionWeb(UserContext uc) {
super(uc);
this.uc = uc;
}
/**
* 获取版本列表
*
* @param versionListDTO 版本对比参数
*/
public String getVersionList(VersionListDTO versionListDTO) {
ResponseObject ro = ResponseObject.newOkResponse();
String id = versionListDTO.getId();
List<VersionListVO> versionListVoList = new ArrayList<>();
List<VersionListVO> historyVersionListVoList = new ArrayList<>();
PALRepositoryModel palModel = PALRepositoryCache.getCache().get(id);
if (palModel != null) {
// 维护pal模型Id与bpm平台模型Id映射
Map<String, String> mapOfProcessDefId = new HashMap<>();
List<PALRepositoryModel> plVersionModels = PALRepositoryCache.getByVersionId(palModel.getVersionId());
for (PALRepositoryModel model : plVersionModels) {
CoeProcessLevelCorrelateModel correlateModel = CoeProcessLevelCorrelateCache.getCache().get(model.getId());
if (correlateModel == null) {
continue;
}
String processDefId = correlateModel.isCorrelate() ? correlateModel.getPlAwsId() : correlateModel.getSourceAwsId();
if (UtilString.isEmpty(processDefId)) {
continue;
}
ProcessDefinition processDefinition = ProcessDefCache.getInstance().get(processDefId);
if (processDefinition == null) {
continue;
}
mapOfProcessDefId.put(model.getId(), processDefId);
VersionListVO versionListVo = DesignerVersionUtil.getVersionListVo(model, processDefinition, correlateModel.getCreateDate());
versionListVoList.add(versionListVo);
}
if (!versionListVoList.isEmpty()) {
versionListVoList.sort(Comparator.comparing(VersionListVO::getCorrelateTime).reversed());
// 历史版本
historyVersionListVoList = DesignerVersionUtil.getVersionListVoList(id, mapOfProcessDefId);
} else {
versionListVoList = DesignerVersionUtil.getVersionListVoList(id, mapOfProcessDefId);
}
}
ro.put("versionList", versionListVoList);
ro.put("historyList", historyVersionListVoList);
return ro.toString();
}
/**
* 版本对比
*
* @param versionCompareDTO 版本对比参数
*/
public String designerVersionCompare(VersionCompareDTO versionCompareDTO) {
Map<String, Object> macroLibraries = queryDesignerVersionCompareMap(versionCompareDTO);
return HtmlPageTemplate.merge(CoEConstant.APP_ID, CoeDesignerConstant.DESIGNER_VERSION_COMPARE_PAGE, macroLibraries);
}
/**
* 获取 版本对比 map参数
*
* @param versionCompareDTO 版本对比参数
*/
private Map<String, Object> queryDesignerVersionCompareMap(VersionCompareDTO versionCompareDTO) {
// 获取对比版本的模型数据
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(versionCompareDTO.getCompareVerId());
JSONObject versionData = DesignerVersionUtil.getVersionData(uc, versionCompareDTO.getCompareVerId(), versionCompareDTO.getTeamId());
if (versionData == null) {
throw new AWSException(I18nRes.findValue(CoEConstant.APP_ID, "获取待比对的版本数据失败"));
}
// 获取当前模型数据
JSONObject curData = DesignerVersionUtil.getVersionData(uc, versionCompareDTO.getCurId(), versionCompareDTO.getTeamId());
if (curData == null) {
throw new AWSException(I18nRes.findValue(CoEConstant.APP_ID, "获取当前使用的版本数据失败"));
}
return DesignerVersionUtil.queryDesignerVersionCompareMap(plModel.getWsId(), plModel.getMethodId(), plModel.getName(), versionCompareDTO.getCompareVerId(), versionData, versionCompareDTO.getCurId(), curData, false, false);
}
}

View File

@ -1,5 +1,7 @@
package com.actionsoft.apps.coe.pal.pal.repository.model;
import java.sql.Timestamp;
import com.actionsoft.bpms.commons.mvc.model.ModelBean;
/**
@ -26,6 +28,10 @@ public class CoeProcessLevelCorrelateModel extends ModelBean{
public static final String FIELD_EXT2 = "EXT2";// add by sunlh
public static final String FIELD_EXT3 = "EXT3";// add by sunlh
public static final String FIELD_EXT4 = "EXT4";// add by sunlh
public static final String FIELD_SOURCEAWSID = "SOURCEAWSID"; // 来源AWS流程ID 版本迭代时当前流程是由哪个流程新建版本而来
public static final String FIELD_CREATEDATE = "CREATEDATE";
public static final String FIELD_CONTROLMODE = "CONTROLMODE"; // 流程管控模式
private int controlMode;
private String wsId;
private String plId;
@ -39,6 +45,8 @@ public class CoeProcessLevelCorrelateModel extends ModelBean{
private String ext2 = "";
private String ext3 = "";
private String ext4;
private String sourceAwsId;
private Timestamp createDate;
public CoeProcessLevelCorrelateModel() {
this.wsId = "";
@ -135,5 +143,25 @@ public class CoeProcessLevelCorrelateModel extends ModelBean{
public void setExt4(String ext4) {
this.ext4 = ext4;
}
public String getSourceAwsId() {
return sourceAwsId;
}
public void setSourceAwsId(String sourceAwsId) {
this.sourceAwsId = sourceAwsId;
}
public Timestamp getCreateDate() {
return createDate;
}
public void setCreateDate(Timestamp createDate) {
this.createDate = createDate;
}
public int getControlMode() {
return controlMode;
}
public void setControlMode(int controlMode) {
this.controlMode = controlMode;
}
}

View File

@ -0,0 +1,163 @@
package com.actionsoft.apps.coe.pal.pal.repository.upfile.cache;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.dao.UpFileDao;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
import com.actionsoft.apps.resource.plugin.profile.CachePluginProfile;
import com.actionsoft.bpms.commons.cache.Cache;
import com.actionsoft.bpms.commons.cache.CacheManager;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.exception.AWSException;
import com.actionsoft.i18n.I18nRes;
import com.actionsoft.sdk.local.SDK;
/**
* 资产文件附件Cache
*/
public class PALUpfileCache extends Cache<String, UpfileModel> {
private static final Logger LOGGER = LoggerFactory.getLogger(PALUpfileCache.class);
public PALUpfileCache(CachePluginProfile profile) {
super(profile);
registeIndex(PALUpfileCacheIndex1.class, new PALUpfileCacheIndex1()); // key pl_uuid
}
public static PALUpfileCache getCache() {
return CacheManager.getCache(PALUpfileCache.class);
}
public static void putModel(UpfileModel model) {
if (model == null) {
String msg = I18nRes.findValue(CoEConstant.APP_ID, "附件") + "model" + I18nRes.findValue(CoEConstant.APP_ID, "不允许为空");
throw new AWSException(msg);
}
getCache().put(model.getUuid(), model);
}
public static void removeById(String uuid) {
if (StringUtils.isEmpty(uuid)) {
throw new AWSException(I18nRes.findValue(CoEConstant.APP_ID, "附件") + "uuid" + I18nRes.findValue(CoEConstant.APP_ID, "不允许为空"));
}
getCache().remove(uuid);
}
public static List<UpfileModel> getByPlUuid(String plUuid) {
List<UpfileModel> upfileModels = iteratorToList(getCache().getByIndex(PALUpfileCacheIndex1.class, plUuid));
if (upfileModels.isEmpty()) {
return Collections.emptyList();
}
upfileModels.sort(new UpfileComparator());// 排序
return upfileModels;
}
/**
* 根据 plId 附件类型 删除缓存数据
*/
public static void removeByPlIdAndType(String plUuid, String type) {
if (plUuid == null || type == null) {
return;
}
Iterator<UpfileModel> iter = getCache().getByIndex(PALUpfileCacheIndex1.class, plUuid);
while (iter.hasNext()) {
UpfileModel next = iter.next();
if (next.getType().equals(type)) {
getCache().remove(next.getUuid());
}
}
}
/**
* 根据 plId 删除缓存数据
*/
public static void removeByPlId(String plUuid) {
if (plUuid == null) {
return;
}
Iterator<UpfileModel> iter = getCache().getByIndex(PALUpfileCacheIndex1.class, plUuid);
while (iter.hasNext()) {
UpfileModel next = iter.next();
getCache().remove(next.getUuid());
}
}
public static List<UpfileModel> getByPlUuidAndType(String plUuid, String type) {
List<UpfileModel> listByPlUuid = getByPlUuid(plUuid);
if (listByPlUuid.isEmpty()) {
return Collections.emptyList();
}
listByPlUuid = listByPlUuid.stream()
// 过滤
.filter(item -> type.equals(item.getType()))
// 排序
.sorted(new UpfileComparator()).collect(Collectors.toList());
return listByPlUuid;
}
public static List<UpfileModel> getByPlUuidAndShapeIds(String plUuid, List<String> shapeIds) {
if (UtilString.isEmpty(plUuid) || shapeIds == null || shapeIds.isEmpty()) {
return Collections.emptyList();
}
List<UpfileModel> listByPlUuid = getByPlUuid(plUuid);
if (listByPlUuid.isEmpty()) {
return Collections.emptyList();
}
listByPlUuid = listByPlUuid.stream()
// 过滤
.filter(item -> shapeIds.contains(item.getShape_uuid()))
// 排序
.sorted(new UpfileComparator()).collect(Collectors.toList());
return listByPlUuid;
}
public static List<UpfileModel> getByPlUuidAndShapeId(String plUuid, String shapeId) {
if (UtilString.isEmpty(plUuid) || UtilString.isEmpty(shapeId)) {
return Collections.emptyList();
}
List<UpfileModel> listByPlUuid = getByPlUuid(plUuid);
if (listByPlUuid.isEmpty()) {
return Collections.emptyList();
}
return listByPlUuid.stream().filter(item -> shapeId.equals(item.getShape_uuid())).collect(Collectors.toList());
}
@Override
protected void load() {
load(this);
}
protected void load(Cache<String, UpfileModel> t) {
UpFileDao upFileDao = new UpFileDao();
List<UpfileModel> _list = upFileDao.queryAll();
if (_list != null && _list.size() > 0) {
for (UpfileModel model : _list) {
t.put(model.getUuid(), model, false);
}
}
LOGGER.info("[{}]Cache加载CoE流程资产库附件配置 [{}个]", SDK.getAppAPI().getAppContext(CoEConstant.APP_ID).getNameI18N(), ((_list == null) ? 0 : _list.size()));
}
static class UpfileComparator implements Comparator<UpfileModel> {
@Override
public int compare(UpfileModel o1, UpfileModel o2) {
// 首先比较创建时间倒序
int createTimeComparison = o2.getCreateTime().compareTo(o1.getCreateTime());
if (createTimeComparison != 0) {
return createTimeComparison;
}
// 如果创建时间相同比较名字默认升序
return o1.getFileName().compareTo(o2.getFileName());
}
}
}

View File

@ -0,0 +1,11 @@
package com.actionsoft.apps.coe.pal.pal.repository.upfile.cache;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
import com.actionsoft.bpms.commons.cache.ListValueIndex;
public class PALUpfileCacheIndex1 extends ListValueIndex<String, UpfileModel> {
@Override
public String key(UpfileModel upfileModel) {
return upfileModel.getPl_uuid();
}
}

View File

@ -14,4 +14,7 @@ public interface CoeFileConstant {
*/
String COE_UPFILE = "COE_Upfile";
String TMP_UPFILE = "tmp";
String FILE_TYPE_F = "f"; // 模型附件
String FILE_TYPE_S = "s"; // 形状附件
String FILE_TYPE_A = "a"; // 属性附件
}

View File

@ -5,6 +5,8 @@ import com.actionsoft.bpms.commons.database.RowMapper;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.exception.AWSDataAccessException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
@ -20,6 +22,7 @@ import java.util.Map;
* @version 创建时间2014-4-8
*/
public class UpFileDao {
private static final Logger LOGGER = LoggerFactory.getLogger(UpFileDao.class);
/**
* 创建附件Model
*
@ -251,4 +254,18 @@ public class UpFileDao {
return DBSql.query(sql, new UpfileModelMapper(), new Object[]{uuid, shapeId});
}
}
/**
* 获取所有文件附件
*
* @return
*/
public List<UpfileModel> queryAll() {
String sql = "SELECT * FROM " + UpfileModel.DATABASE_ENTITY;
try {
return DBSql.query(sql, new UpfileModelMapper());
} catch (AWSDataAccessException e) {
LOGGER.error(e.getMessage(), e);
}
return new ArrayList<UpfileModel>();
}
}

View File

@ -3,6 +3,7 @@
*/
package com.actionsoft.apps.coe.pal.pal.repository.upfile.model;
import java.io.Serializable;
import java.sql.Timestamp;
/**
@ -10,7 +11,7 @@ import java.sql.Timestamp;
* @version 创建时间2014-4-8
*
*/
public class UpfileModel {
public class UpfileModel implements Serializable {
public static final String DATABASE_ENTITY = "APP_ACT_COE_PAL_UPFILE";
public static final String FIELD_UUID = "ID";
public static final String FIELD_PL_UUID = "PALREPOSITORYID";
@ -22,6 +23,7 @@ public class UpfileModel {
public static final String FIELD_SECURITY_LEVEL = "SECURITYLEVEL";
public static final String FIELD_CREATEUSER = "CREATEUSER";
public static final String FIELD_CREATETIME = "CREATETIME";
public static final String FIELD_ATTRID = "ATTRID";
private String uuid;
/**
@ -65,6 +67,10 @@ public class UpfileModel {
* 上传时间
*/
private Timestamp createTime;
/**
* 属性id
*/
private String attrId;
/**
* 下载url数据库无该字段后期自行拼装
@ -150,5 +156,12 @@ public class UpfileModel {
public void setCreateTime(Timestamp createTime) {
this.createTime = createTime;
}
public String getAttrId() {
return attrId;
}
public void setAttrId(String attrId) {
this.attrId = attrId;
}
}

View File

@ -0,0 +1,304 @@
package com.actionsoft.apps.coe.pal.pal.repository.upfile.util;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.actionsoft.apps.coe.pal.components.model.PALSecurityLevelModel;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
//import com.actionsoft.apps.coe.pal.pal.method.cache.PALMethodAttributeCache;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodAttributeModel;
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.PALRepositoryModel;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.cache.PALUpfileCache;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.constant.CoeFileConstant;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil;
import com.actionsoft.apps.coe.pal.util.HighSecurityUtil;
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.fs.DCContext;
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
import com.actionsoft.bpms.server.fs.dc.DCUtil;
import com.actionsoft.bpms.util.UtilString;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
/**
* COE 附件上传工具类 处理设计器中 文件附件形状附件 <br/>
* 属性附件参考 {@link MethodAttrUpFileUtil}
*/
public class CoeUpFileUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(CoeUpFileUtil.class);
/**
* DCPluginProfile 对象 COE_Upfile
*/
private static final DCPluginProfile DC_UPFILE_PROFILE = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
/**
* 获取 DCContext
*
* @param uc 用户上下文
* @param model 上传文件模型
*/
public static DCContext getUpFileDCContext(UserContext uc, UpfileModel model) {
DCContext dcContext = null;
if (DC_UPFILE_PROFILE != null) {
if (CoeFileConstant.FILE_TYPE_F.equals(model.getType())) {
// 文件
dcContext = new DCContext(uc, DC_UPFILE_PROFILE, CoEConstant.APP_ID, "file", model.getPl_uuid(), model.getFileName());
} else if (CoeFileConstant.FILE_TYPE_S.equals(model.getType())) {
// 图形
dcContext = new DCContext(uc, DC_UPFILE_PROFILE, CoEConstant.APP_ID, model.getPl_uuid(), model.getShape_uuid(), model.getFileName());
} else {
// 属性
dcContext = MethodAttrUpFileUtil.getDCContext(model, uc);
}
}
return dcContext;
}
/**
* 获取 上传文件的 DCContext
*/
public static DCContext getUpFileDCContext(UserContext uc, String groupValue, String fileValue, String fileName) {
DCContext dcContext = null;
if (DC_UPFILE_PROFILE != null) {
dcContext = new DCContext(uc, DC_UPFILE_PROFILE, CoEConstant.APP_ID, groupValue, fileValue, fileName);
}
return dcContext;
}
//
// /**
// * 获取tmp目录对应DCContext
// * <pre>
// * 文件附件tmp/upfile/uuid/fileName
// * 形状附件tmp/upfile/uuid_shapeId/fileName
// * 文件属性附件tmp/attr_upfile/uuid_attrId/fileName
// * 形状属性附件tmp/attr_upfile/uuid_shapeId_attrId/fileName
// * </pre>
// *
// * @param model 上传文件模型
// */
// public static DCContext getTmpUpFileDCContext(UpfileModel model) {
// return getTmpUpFileDCContext(model.getType(), model.getPl_uuid(), model.getShape_uuid(), model.getAttrId(), model.getFileName());
// }
//
// /**
// * 获取tmp目录对应DCContext
// * <pre>
// * 文件附件tmp/upfile/uuid/fileName
// * 形状附件tmp/upfile/uuid_shapeId/fileName
// * 文件属性附件tmp/attr_upfile/uuid_attrId/fileName
// * 形状属性附件tmp/attr_upfile/uuid_shapeId_attrId/fileName
// * </pre>
// */
// public static DCContext getTmpUpFileDCContext(String type, String plId, String shapeId, String attrId, String fileName) {
// DCContext dcContext = null;
// if (CoeFileConstant.FILE_TYPE_F.equals(type)) {
// // 文件
// dcContext = DCUtil.createTempFileContext(CoEConstant.APP_ID, "upfile", plId, null);
// } else if (CoeFileConstant.FILE_TYPE_S.equals(type)) {
// // 图形
// dcContext = DCUtil.createTempFileContext(CoEConstant.APP_ID, "upfile", plId + "_" + shapeId, null);
// } else if (CoeFileConstant.FILE_TYPE_A.equals(type)) {
// // 属性
// dcContext = MethodAttrUpFileUtil.getTmpUpFileDCContext(plId, shapeId, attrId, fileName);
// }
// // 设置文件名称
// if (dcContext != null) {
// dcContext.setFileName(fileName);
// }
// return dcContext;
// }
//
// /**
// * 将tmp目录中文件移动到COE目录下移动后删除tmp目录文件
// */
// public static void moveTmpFileToCOE(UpfileModel model) {
// DCContext tmpContext = CoeUpFileUtil.getTmpUpFileDCContext(model);
// DCContext coeContext = CoeUpFileUtil.getUpFileDCContext(null, model);
// if (tmpContext != null && coeContext != null) {
// String fName = model.getFileName();
// tmpContext.setFileName(fName);
// coeContext.setFileName(fName);
// if (tmpContext.existFile()) {
// DCUtil.copyDCFile(tmpContext, coeContext);
// tmpContext.delete();
// }
// }
// }
//
// /**
// * 删除DC目录及文件
// *
// * @param dcContext 文件上传 DC对象
// * @throws Exception 异常抛出
// */
// public static void removeUpFileDc(DCContext dcContext) throws Exception {
// if (dcContext != null) {
// dcContext.delete();
// String fName = dcContext.getFileName();
// if (!fName.contains(".")) {
// return;
// }
// String dirName = fName.substring(0, fName.lastIndexOf("."));
// dcContext.setFileName(dirName);
// if (dcContext.existFile()) {
// dcContext.delete();
// }
// // pdf 删除
// if (!fName.endsWith(".pdf")) {
// dcContext.setFileName(dirName + ".pdf");
// if (dcContext.existFile()) {
// dcContext.delete();
// }
// }
// }
// }
//
// /**
// * 组装附件列表信息
// *
// * @param wsId 资产库ID
// * @param methodId 建模方法ID
// * @param plId 模型ID
// * @param fileAttachmentList 文件附件列表
// * @param shapeAttachmentMap 形状附件map数据 key:shapeId,value JSONArray
// * @param relationAttachmentList 文件关联附件列表
// * @param relationShapeAttachmentMap 关联形状附件map数据 key:shapeId,value JSONArray
// */
// public static void wrapperAttachmentList(UserContext uc, String wsId, String methodId, String plId, JSONArray fileAttachmentList, Map<String, JSONArray> shapeAttachmentMap, JSONArray relationAttachmentList, Map<String, JSONArray> relationShapeAttachmentMap) {
// List<UpfileModel> upfileModels = PALUpfileCache.getByPlUuid(plId);
// for (UpfileModel model : upfileModels) {
// String shapeUuid = model.getShape_uuid();
// JSONObject object = wrapperAttachmentObj(uc, model);
// if ("f".equals(model.getType())) {
// fileAttachmentList.add(object);
// } else if ("s".equals(model.getType()) && UtilString.isNotEmpty(shapeUuid)) {
// shapeAttachmentMap.computeIfAbsent(shapeUuid, k -> new JSONArray()).add(object);
// }
// }
// List<DesignerShapeRelationModel> relationModels = DesignerShapeRelationCache.getListByFileId(plId);
// Map<Boolean, List<DesignerShapeRelationModel>> relationModelsMap = relationModels.stream().collect(Collectors.groupingBy(item -> UtilString.isEmpty(item.getShapeId())));
// // 关联附件列表
// List<DesignerShapeRelationModel> fileRelationModels = relationModelsMap.getOrDefault(true, Collections.emptyList());
// List<DesignerShapeRelationModel> shapeRelationModels = relationModelsMap.getOrDefault(false, Collections.emptyList());
//
// // 文件关联附件组装
// List<UpfileModel> relFileUpfileModels = getRelationAttachmentList(wsId, methodId, fileRelationModels);
// relFileUpfileModels.forEach(model -> relationAttachmentList.add(wrapperAttachmentObj(uc, model)));
// // 形状关联附件组装
// Map<String, List<DesignerShapeRelationModel>> shapeRelationModelsMap = shapeRelationModels.stream().filter(item -> UtilString.isNotEmpty(item.getShapeId())).collect(Collectors.groupingBy(DesignerShapeRelationModel::getShapeId));
// for (Map.Entry<String, List<DesignerShapeRelationModel>> entry : shapeRelationModelsMap.entrySet()) {
// String shapeId = entry.getKey();
// List<DesignerShapeRelationModel> models = entry.getValue();
// List<UpfileModel> relShapeUpfileModels = getRelationAttachmentList(wsId, methodId, models);
// relShapeUpfileModels.forEach(model -> {
// // 组装附件信息
// JSONObject object = wrapperAttachmentObj(uc, model);
// relationShapeAttachmentMap.computeIfAbsent(shapeId, k -> new JSONArray()).add(object);
// });
// }
// }
//
// /**
// * 组装附件信息
// */
// public static JSONObject wrapperAttachmentObj(UserContext uc, UpfileModel model) {
// return wrapperAttachmentObj(uc, model, null);
// }
//
// /**
// * 组装附件信息
// */
// public static JSONObject wrapperAttachmentObj(UserContext uc, UpfileModel model, JSONObject refObj) {
// JSONObject object = new JSONObject();
// object.put("fileName", model.getFileName());
// object.put("fileId", model.getUuid());
// object.put("uuid", model.getUuid());
// object.put("attrId", model.getAttrId());
// object.put("shapeId", model.getShape_uuid());
// object.put("download", model.getDownload());
// object.put("securityLevel", model.getSecurityLevel());
// object.put("hasSecurity", true);
// if (HighSecurityUtil.isON() && HighSecurityUtil.fileSecuritySwitch()) {
// int userSecurityLevel = uc.getUserModel().getSecurityLevel();
// PALSecurityLevelModel upFileSecurityLevelInfo = HighSecurityUtil.getUpFileSecurityLevelInfo(model.getUuid());
// int upfileSecurityLevel = Integer.parseInt(upFileSecurityLevelInfo.getCode());
// if (userSecurityLevel < upfileSecurityLevel) {
// object.put("hasSecurity", false);
// }
// object.put("securityInfo", upFileSecurityLevelInfo);
// }
// boolean isDownload = true;
// // 判断ref是否存在
// if (refObj != null) {
// isDownload = refObj.getBooleanValue("isDownload");
// boolean isPreview = refObj.getBooleanValue("isPreview");
// object.put("isDownload", isDownload);
// object.put("isPreview", isPreview);
// }
// String downloadURL = "";
// if (isDownload) {
// DCContext dcContext = CoeUpFileUtil.getUpFileDCContext(uc, model);
// if (dcContext != null) {
// downloadURL = dcContext.getDownloadURL() + "&isInline=false";
// }
// }
// object.put("url", downloadURL);
// return object;
// }
//
// /**
// * 获取当前模型关联的其他模型的附件集合
// */
// public static List<UpfileModel> getRelationAttachmentList(String wsId, String methodId, List<DesignerShapeRelationModel> relationModels) {
// List<UpfileModel> relUpfileModels = new ArrayList<>();
// // attrKey , relationType[ref中的type]
// Map<String, String> relationTypeMap = new HashMap<>();
// // 获取属性列表
// List<PALMethodAttributeModel> attributeList = PALMethodAttributeCache.getListByMethodIdAndWsId(methodId, wsId);
// for (PALMethodAttributeModel model : attributeList) {
// String relationType = "shape";
// if ("relation".equals(model.getType())) {
// JSONObject refObj = JSONObject.parseObject(model.getRef());
// relationType = refObj.containsKey("type") ? refObj.getString("type") : "shape";
// }
// relationTypeMap.put(model.getKey(), relationType);
// }
// for (DesignerShapeRelationModel relationModel : relationModels) {
// String attrId = relationModel.getAttrId();
// if (!relationTypeMap.containsKey(attrId)) {
// continue;
// }
// String type = relationTypeMap.get(attrId);
// if ("file".equals(type)) {
// String relationFileId = relationModel.getRelationFileId();
// PALRepositoryModel uesRelPlModel = CoeProcessLevelUtil.getUseRepositoryByVersionId(relationFileId);
// if (uesRelPlModel != null) {
// List<UpfileModel> useRelUpFileList = PALUpfileCache.getByPlUuid(uesRelPlModel.getId());
// if (!useRelUpFileList.isEmpty()) {
// relUpfileModels.addAll(useRelUpFileList);
// }
// }
// } else {
// List<UpfileModel> useRelUpFileList = PALUpfileCache.getByPlUuidAndShapeId(relationModel.getRelationFileId(), relationModel.getRelationShapeId());
// if (!useRelUpFileList.isEmpty()) {
// relUpfileModels.addAll(useRelUpFileList);
// }
// }
// }
// return relUpfileModels;
// }
}

View File

@ -0,0 +1,125 @@
package com.actionsoft.apps.coe.pal.pal.repository.upfile.util;
import java.util.HashSet;
import java.util.Set;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
import com.actionsoft.apps.coe.pal.pal.method.constant.PALMethodConst;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.fs.DCContext;
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
import com.actionsoft.bpms.server.fs.dc.DCUtil;
import com.actionsoft.bpms.util.UtilString;
/**
* @author oYang
* @Description 建模属性附件工具类
* @createTime 2024年03月26日 17:06:00
*/
public class MethodAttrUpFileUtil {
private static final Set<String> audioAndImageTypes = new HashSet<>();
static {
audioAndImageTypes.add("jpg");
audioAndImageTypes.add("jpeg");
audioAndImageTypes.add("png");
audioAndImageTypes.add("gif");
audioAndImageTypes.add("mp3");
audioAndImageTypes.add("mp4");
audioAndImageTypes.add("avi");
}
/**
* 获取DCContext
*
* @param upfileModel 文件模型
* @param userContext 用户上下文
* @return DCContext
*/
public static DCContext getDCContext(UpfileModel upfileModel, UserContext userContext) {
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, PALMethodConst.ATTR_FILE_DC_REPOSITORY_NAME);
DCContext dcContext = null;
String fileName = upfileModel.getFileName();
if (dcProfile != null) {
if (UtilString.isEmpty(upfileModel.getShape_uuid())) { // 文件属性附件
dcContext = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, upfileModel.getPl_uuid(), upfileModel.getAttrId(), fileName);
} else {
dcContext = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, upfileModel.getPl_uuid(), upfileModel.getShape_uuid() + "_" + upfileModel.getAttrId(), fileName);
}
}
return dcContext;
}
/**
* 获取DCContext
*
* @param dcPluginProfile
* @param userContext
* @param upfileModel
* @return
*/
public static DCContext getDCContext(DCPluginProfile dcPluginProfile, UserContext userContext, UpfileModel upfileModel) {
DCContext dcContext = null;
if (UtilString.isEmpty(upfileModel.getShape_uuid())) { // 文件属性附件
dcContext = new DCContext(userContext, dcPluginProfile, CoEConstant.APP_ID, upfileModel.getPl_uuid(), upfileModel.getAttrId());
} else {
dcContext = new DCContext(userContext, dcPluginProfile, CoEConstant.APP_ID, upfileModel.getPl_uuid(), upfileModel.getShape_uuid() + "_" + upfileModel.getAttrId());
}
return dcContext;
}
//
// /**
// * 获取属性附件临时目录
// * <pre>
// * 文件属性附件tmp/attr_upfile/uuid_attrId/fileName
// * 形状属性附件tmp/attr_upfile/uuid_shapeId_attrId/fileName
// * </pre>
// *
// * @return DCContext 对象
// */
// public static DCContext getTmpUpFileDCContext(UpfileModel upfileModel) {
// DCContext dcContext;
// if (UtilString.isEmpty(upfileModel.getShape_uuid())) {
// // 文件属性附件
// dcContext = DCUtil.createTempFileContext(CoEConstant.APP_ID, PALMethodConst.ATTR_FILE_DC_REPOSITORY_NAME, upfileModel.getPl_uuid() + "_" + upfileModel.getAttrId(), upfileModel.getFileName());
// } else {
// dcContext = DCUtil.createTempFileContext(CoEConstant.APP_ID, PALMethodConst.ATTR_FILE_DC_REPOSITORY_NAME, upfileModel.getPl_uuid() + "_" + upfileModel.getShape_uuid() + "_" + upfileModel.getAttrId(), upfileModel.getFileName());
// }
// return dcContext;
// }
//
// /**
// * 获取属性附件临时目录
// * <pre>
// * 文件属性附件tmp/attr_upfile/uuid_attrId/fileName
// * 形状属性附件tmp/attr_upfile/uuid_shapeId_attrId/fileName
// * </pre>
// *
// * @return DCContext 对象
// */
// public static DCContext getTmpUpFileDCContext(String plId, String shapeId, String attrId, String fileName) {
// DCContext dcContext;
// if (UtilString.isEmpty(shapeId)) {
// // 文件属性附件
// dcContext = DCUtil.createTempFileContext(CoEConstant.APP_ID, PALMethodConst.ATTR_FILE_DC_REPOSITORY_NAME, plId + "_" + attrId, null);
// } else {
// dcContext = DCUtil.createTempFileContext(CoEConstant.APP_ID, PALMethodConst.ATTR_FILE_DC_REPOSITORY_NAME, plId + "_" + shapeId + "_" + attrId, null);
// }
// dcContext.setFileName(fileName);
// return dcContext;
// }
//
// /**
// * 判断文件类型是否是音频或图片
// *
// * @param fileType 文件类型
// * @return true/false
// */
// public static boolean predicateFileTypeIsAudioOrImage(String fileType) {
// return audioAndImageTypes.contains(fileType);
// }
}

View File

@ -63,6 +63,8 @@ import com.actionsoft.apps.coe.pal.pal.manage.publish.cache.PublishUserGroupCach
import com.actionsoft.apps.coe.pal.pal.manage.publish.cache.PublishUserGroupPermCache;
import com.actionsoft.apps.coe.pal.pal.manage.publish.cache.PublishUserGroupRoleCache;
import com.actionsoft.apps.coe.pal.pal.method.aslp.RegisterMethodApp;
import com.actionsoft.apps.coe.pal.pal.method.cache.PALBasicMethodCache;
import com.actionsoft.apps.coe.pal.pal.method.cache.PALMethodSchemaCache;
import com.actionsoft.apps.coe.pal.pal.output.aslp.RegisterOutputApp;
import com.actionsoft.apps.coe.pal.pal.repository.addons.RepositoryDiagramExistMark;
import com.actionsoft.apps.coe.pal.pal.repository.cache.CoeProcessLevelCorrelateCache;
@ -80,6 +82,7 @@ import com.actionsoft.apps.coe.pal.pal.repository.designer.realtime.manage.CoeLi
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.DesignerShapeRelationCache;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.manager.DesignerShapeCopyCache;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.CoeFileProcessor;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.cache.PALUpfileCache;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.constant.CoeFileConstant;
import com.actionsoft.apps.coe.pal.teamwork.cache.TeamMemberPermCache;
import com.actionsoft.apps.coe.pal.teamwork.cache.TeamPermCache;
@ -134,6 +137,9 @@ public class Plugins implements PluginListener {
list.add(new CachePluginProfile(CoeCooperationTeamPermCache.class));
list.add(new CachePluginProfile(CoeCooperationRoleCache.class));
list.add(new CachePluginProfile(CoeCooperationRolePermCache.class));
list.add(new CachePluginProfile(PALUpfileCache.class));
list.add(new CachePluginProfile(PALBasicMethodCache.class));
list.add(new CachePluginProfile(PALMethodSchemaCache.class));
list.add(new AtFormulaPluginProfile("PAL应用", "@getDWCondition(*fieldName,*fieldValue)", GetDWConditionExpression.class.getName(), "获取DW中的自定义查询条件", "返回DW中自定义的查询条件"));

View File

@ -0,0 +1,171 @@
package com.actionsoft.apps.coe.pal.util;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.actionsoft.bpms.server.fs.DCContext;
import com.actionsoft.bpms.util.Base64;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
/**
* COE处理DC工具类
*/
public class CoeDcUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(CoeDcUtil.class);
/**
* 类型转换 {@link DCContext } 转换为 {@link JSONArray} <br/>
* DC判空且判断DC文件是否存在不存在则返回 null
*
* @return 返回 JSONArray 若为空则返回 null
*/
public static JSONArray dcContextToJa(DCContext dcContext) {
if (dcContext == null || !dcContext.existFile()) {
return null;
}
InputStream read = SDK.getDCAPI().read(dcContext);
return inputStreamToJa(read);
}
/**
* 类型转换 {@link DCContext } 转换为 {@link JSONObject} <br/>
* DC判空且判断DC文件是否存在不存在则返回 null
*
* @return 返回 JSONObject 若为空则返回 null
*/
public static JSONObject dcContextToJo(DCContext dcContext) {
if (dcContext == null || !dcContext.existFile()) {
return null;
}
InputStream read = SDK.getDCAPI().read(dcContext);
return inputStreamToJo(read);
}
/**
* 类型转换 {@link DCContext } 转换为 {@link String} <br/>
* DC判空且判断DC文件是否存在不存在则返回 null
*
* @return 返回 String 若为空则返回 "";
*/
public static String dcContextToString(DCContext dcContext) {
if (dcContext == null || !dcContext.existFile()) {
return "";
}
InputStream read = SDK.getDCAPI().read(dcContext);
return inputStreamToString(read);
}
/**
* 类型转换 {@link DCContext } 转换为 {@link String} <br/>
* DC判空且判断DC文件是否存在不存在则返回 null
*
* @return 返回 byte 若为空则返回 null
*/
public static byte[] dcContextToByte(DCContext dcContext) {
if (dcContext == null || !dcContext.existFile()) {
return null;
}
InputStream read = SDK.getDCAPI().read(dcContext);
return inputStreamToByte(read);
}
/**
* 类型转换 {@link DCContext } 转换为 base64 数据 {@link String} <br/>
* DC判空且判断DC文件是否存在不存在则返回 null <br/>
* 携带前缀data:image/png;base64,
*
* @return 返回 byte 若为空则返回 null
*/
public static String dcContextToBase64(DCContext dcContext) {
byte[] bytes = dcContextToByte(dcContext);
if (bytes == null) {
return null;
}
byte[] base64Bytes = Base64.encode(bytes);
return "data:image/png;base64," + new String(base64Bytes, StandardCharsets.UTF_8);
}
/**
* 类型转换 {@link InputStream } 转换为 {@link JSONArray}
*
* @return 返回 JSONArray 若为空则返回 null
*/
public static JSONArray inputStreamToJa(InputStream inputStream) {
String str = inputStreamToString(inputStream);
try {
return JSONArray.parseArray(str);
} catch (Exception e) {
LOGGER.error("inputStream[{}]格式不正确转换JSONArray[失败]", str, e);
return null;
}
}
/**
* 类型转换 {@link InputStream } 转换为 {@link JSONObject}
*
* @return 返回 JSONObject 若为空则返回 null
*/
public static JSONObject inputStreamToJo(InputStream inputStream) {
String str = inputStreamToString(inputStream);
try {
return JSON.parseObject(str);
} catch (Exception e) {
LOGGER.error("inputStream[{}]格式不正确转换JSONObject[失败]", str, e);
return null;
}
}
/**
* 类型转换 {@link InputStream } 转换为 {@link String}
*
* @return 返回 String 若为空则返回 null
*/
public static String inputStreamToString(InputStream inputStream) {
if (inputStream == null) {
return null;
}
try {
return IOUtils.toString(inputStream, StandardCharsets.UTF_8);
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
return null;
}
}
/**
* 类型转换 {@link InputStream } 转换为 byte[]
*
* @return 返回 byte[] 若为空则返回 null
*/
public static byte[] inputStreamToByte(InputStream inputStream) {
if (inputStream == null) {
return null;
}
try {
return IOUtils.toByteArray(inputStream);
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
return null;
}
}
/**
* 数据写入 DC
*/
public static boolean write(String define, DCContext dcContext) {
if (define == null || dcContext == null) {
return false;
}
return SDK.getDCAPI().write(new ByteArrayInputStream(define.getBytes(StandardCharsets.UTF_8)), dcContext);
}
}

View File

@ -13,6 +13,10 @@ import com.actionsoft.i18n.I18nRes;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.actionsoft.apps.coe.pal.components.model.PALSecurityLevelModel;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.cache.PALUpfileCache;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
import com.actionsoft.exception.AWSException;
import java.lang.reflect.Field;
import java.util.*;
@ -222,5 +226,65 @@ public class HighSecurityUtil {
boolean fileSwitch = Boolean.parseBoolean(param);
return fileSwitch;
}
/**
* 获取附件密级信息
*
* @param upfileId 附件Id
* @return 密级信息
*/
public static PALSecurityLevelModel getUpFileSecurityLevelInfo(String upfileId) {
UpfileModel upfileModel = PALUpfileCache.getCache().get(upfileId);
Integer securityLevel = upfileModel.getSecurityLevel();
return getSecurityLevelModel(securityLevel);
}
private static PALSecurityLevelModel getSecurityLevelModel(Integer securityLevel) {
if (securityLevel == null || securityLevel == -1) {
return new PALSecurityLevelModel("-1", I18nRes.findValue(CoEConstant.APP_ID, "未标密"), "#f56c6c");
}
Map<String, PALSecurityLevelModel> securityInfoMap = getSecurityInfoMap();
PALSecurityLevelModel userSecurityInfo = securityInfoMap.get(String.valueOf(securityLevel));
if (userSecurityInfo == null) {
return new PALSecurityLevelModel("-1", I18nRes.findValue(CoEConstant.APP_ID, "未知密级"), "#f56c6c");
}
return userSecurityInfo;
}
/**
* 获取密级列表Map
*
* @return 密级列表Map
*/
public static Map<String, PALSecurityLevelModel> getSecurityInfoMap() {
Map<String, PALSecurityLevelModel> map = new HashMap<>();
if (isON()) {
// 获取平台的对象秘级参数设置
HashMap<String, String> securityMap = getObjSecurityMap();
// 获取PAL应用参数密级颜色设置
JSONObject highSecurityFontStyle = getHighSecurityFontStyle();
Set<Map.Entry<String, String>> entries = securityMap.entrySet();
for (Map.Entry<String, String> entry : entries) {
String key = entry.getKey();
String value = entry.getValue();
JSONObject colorObject = highSecurityFontStyle.getJSONObject(key);
String color = "";
if (colorObject != null) {
color = colorObject.getString("color");
}
PALSecurityLevelModel palSecurityLevelModel = new PALSecurityLevelModel(key, value, color);
map.put(key, palSecurityLevelModel);
}
}
return map;
}
/**
* 获取密级样式设置
*
* @return
*/
public static JSONObject getHighSecurityFontStyle() {
JSONObject highSecurityFontStyle = SDK.getAppAPI().getPropertyJSONObjectValue(CoEConstant.APP_ID, "HighSecurityFontStyle", new JSONObject());
if (highSecurityFontStyle == null || highSecurityFontStyle.isEmpty()) {
throw new AWSException("请设置密级样式");
}
return highSecurityFontStyle;
}
}

View File

@ -8,6 +8,7 @@
<link type='text/css' rel='stylesheet' href='../apps/com.actionsoft.apps.coe.pal/lib/designer/themes/default/global_zh.css' />
<link type='text/css' rel='stylesheet' href='../apps/com.actionsoft.apps.coe.pal/lib/designer/themes/default/diagraming/designer.css' />
<link type='text/css' rel='stylesheet' href='../apps/com.actionsoft.apps.coe.pal/lib/designer/themes/default/diagraming/ui.css' />
<link type='text/css' rel='stylesheet' href='../apps/com.actionsoft.apps.coe.pal/lib/designer/themes/default/diagraming/designer.versionCompare.css' />
<link rel="stylesheet" href="../commons/css/awsui.css">
<style>
.button.blue {
@ -176,6 +177,100 @@
<script type='text/javascript' src='../commons/js/jquery/scripts/jquery.js'></script>
<script type="text/javascript" src="../commons/js/jquery/scripts/jquery-migrate.js"></script>
<script type='text/javascript' charset='UTF-8' src='../apps/com.actionsoft.apps.coe.pal/lib/designer/scripts/util.js'></script>
<!-- i18n -->
<script>
var 快速查询 = "<I18N#快速查询>";
var 已保存成功 = "<I18N#已保存成功>";
var 保存成功 = "<I18N#保存成功>";
var 页面中有未保存的内容请先保存 = "<I18N#页面中有未保存的内容请先保存>";
var 保存失败 = "<I18N#保存失败>";
var 列的第 = "<I18N#列的第>";
var 行不允许为空 = "<I18N#行不允许为空>";
var 文件属性 = "<I18N#文件属性>";
var 不允许为空 = "<I18N#不允许为空>";
var 返回 = "<I18N#返回>";
var 版本号 = "<I18N#版本号>";
var 吸色 = "<I18N#吸色>";
var 退出 = "<I18N#退出>";
var 当前颜色 = "<I18N#当前颜色>";
$(document).ready(function(){
$("#queryInput").attr("placeholder", 快速查询);
$("#back-vue-page-span").attr("awsui-qtip", 返回);
$("#toolbar_designer_version_no").attr("awsui-qtip", 版本号);
$("#color_draw").attr("awsui-qtip", 吸色 + "Esc" + 退出);
$("#color_show_now").attr("awsui-qtip", 当前颜色);
});
// designer.ui.debug.js i18n
var 颜色渐变 = "<I18N#颜色渐变>";
var 起始版本 = "<I18N#起始版本>";
var 错误个数 = "<I18N#错误个数>";
var 校验通过 = "<I18N#校验通过>";
var 文件过大不允许超过 = "<I18N#文件过大, 不允许超过>";
var 上传成功 = "<I18N#上传成功>";
var 正在加载预览 = "<I18N#正在加载预览>";
var 此地址下无法加载图片 = "<I18N#此地址下无法加载图片>";
var 请检查图片地址是否正确 = "<I18N#请检查图片地址是否正确>";
var 确保图片地址处于公开状态 = "<I18N#确保图片地址处于公开状态>";
var 正在加载图片 = "<I18N#正在加载图片>";
var 显示更多结果 = "<I18N#显示更多结果>";
var 正在应用图片请稍候 = "<I18N#正在应用图片请稍候>";
var 无法使用此图片请选择其他图片 = "<I18N#无法使用此图片请选择其他图片>";
var 页面中有未保存的内容请先保存 = "<I18N#页面中有未保存的内容请先保存>";
var 请稍后 = "<I18N#请稍后>";
var 请您先保存一个版本 = "<I18N#请您先保存一个版本>";
var 预览 = "<I18N#预览>";
var 图片创建完成 = "<I18N#图片创建完成>";
var 是否打开图片预览 = "<I18N#是否打开图片预览>";
var 导出完成 = "<I18N#导出完成>";
var 确定 = "<I18N#确定>";
var 关闭 = "<I18N#关闭>";
var 节点编号排序 = "<I18N#节点编号排序>";
var 提示 = "<I18N#提示>";
var 拖动排序确定后请保存设计器 = "<I18N#拖动排序确定后请保存设计器>";
var 无名称 = "<I18N#无名称>";
var 不支持编号排序 = "<I18N#不支持编号排序>";
var 画布没有形状或者形状没有编号属性 = "<I18N#画布没有形状或者形状没有编号属性>";
var 名称 = "<I18N#名称>";
var 节点号 = "<I18N#节点号>";
var 新发布 = "<I18N#新发布>";
var 变更 = "<I18N#变更>";
var 停用 = "<I18N#停用>";
var 暂无发布历史 = "<I18N#暂无发布历史>";
var 文件链接 = "<I18N#文件链接>";
var 自定义链接 = "<I18N#自定义链接>";
var 暂无链接 = "<I18N#暂无链接>";
var 处修改 = "<I18N#处修改>";
var 暂停 = "<I18N#暂停>";
var 从此版本播放 = "<I18N#从此版本播放>";
var 浏览器限制无法进入演示视图 = "<I18N#浏览器限制无法进入演示视图>";
var 无法进入全屏视图您可以按F11进入 = "<I18N#无法进入全屏视图您可以按(F11)进入>";
var 秒后自动保存 = "<I18N#秒后自动保存>";
var 修改 = "<I18N#修改>"
var 由 = "<I18N#>"
var 创建 = "<I18N#创建>"
var 新建版本 = "<I18N#新建版本>"
var 版本对比 = "<I18N#版本对比>"
var 切换该版本 = "<I18N#切换该版本>"
var 设计中 = "<I18N#设计中>"
var 已发布 = "<I18N#已发布>"
var 已停用 = "<I18N#已停用>"
var 审核中 = "<I18N#审核中>"
var 设计 = "<I18N#设计>"
var 是否继续切换 = "<I18N#是否继续切换>"
var 历史版本 = "<I18N#历史版本>"
var 提示 = "<I18N#提示>"
var 确定将 = "<I18N#确定将>"
var 版本为模板创建新版本文件 = "<I18N#版本为模板创建新版本文件>"
var 历史版本为模板创建新版本文件 = "<I18N#历史版本为模板创建新版本文件>"
var 请选择版本号 = "<I18N#请选择版本号>"
var 文件修改未保存 = "<I18N#文件修改未保存>"
var 文件已修改未保存 = "<I18N#文件已修改未保存>"
var 附件 = "<I18N#附件>"
var 形状属性 = "<I18N#形状属性>"
var 链接 = "<I18N#链接>"
</script>
<!--扩展设计器的样式-->
<link type='text/css' rel='stylesheet' href='../apps/com.actionsoft.apps.coe.pal/lib/designer/extend/css/designer.extend.css' />
<!--针对设计器进行颜色扩展,以及文字扩充-->
@ -190,6 +285,7 @@
<script src="../apps/com.actionsoft.apps.coe.pal/lib/designer/extend/js/driver.min.js"></script>
<script type="text/javascript">
//公共信息
var wsId = "<#wsId>";
var browserId = "<#browserId>";// 浏览器唯一标识
var appId = "<#appId>";
var sessionId = "<#sid>";
@ -601,11 +697,14 @@
function initContentHtml(obj){
var checkHtml = '';
obj.forEach(function(model, index) {
checkHtml += '<p>';
checkHtml += '<input class="awsui-checkbox" name="tplRadio" id="'+model.id+'" showText="'+model.text+'" type="radio"/>';
checkHtml += '<label class="awsui-checkbox-label">'+model.text+'</label>';
});
if (obj!=undefined) {
obj.forEach(function(model, index) {
checkHtml += '<p>';
checkHtml += '<input class="awsui-checkbox" name="tplRadio" id="'+model.id+'" showText="'+model.text+'" type="radio"/>';
checkHtml += '<label class="awsui-checkbox-label">'+model.text+'</label>';
});
}
return checkHtml;
}
@ -1009,9 +1108,12 @@
}
}*/
</script>
<!-- 版本对比 -->
<script type='text/javascript' async charset='UTF-8' src='../apps/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/versionCompare/version.methods.debug.js'></script>
</head>
<body style="overflow:hidden;" onload="updateShapePanel();">
<div class="compare-main" id="versionCompareBox" style="display:none;"></div>
<canvas id="support_canvas" style="display: none;"></canvas>
<div id="designer_header">
@ -1020,9 +1122,12 @@
<span class="diagram_title"><#fileName></span>
<span id="securityLevelName" style="display: none;"><#securityLevelName></span>
<div id="toolbar_wfversion_info" class="toolbar_info">
<div id="toolbar_designer_version_no" class="info version" awsui-qtip="版本管理">
<!-- <div id="toolbar_designer_version_no" class="info version" awsui-qtip="版本管理">
<#versionNum>
</div>
</div> -->
<span id="toolbar_designer_version_no" class="info version" style="cursor: pointer" awsui-qtip="版本号" onclick="versionListFun.openVersionList()">
<#versionNum>
</span>
<div id="toolbar_wfversion_info_status" style="display:none;" class="versioninfo version0" awsui-qtip="<#state>"><#state></div>
</div>
</div>

View File

@ -8,6 +8,7 @@
<link type='text/css' rel='stylesheet' href='../apps/com.actionsoft.apps.coe.pal/lib/designer/themes/default/global_zh.css' />
<link type='text/css' rel='stylesheet' href='../apps/com.actionsoft.apps.coe.pal/lib/designer/themes/default/diagraming/designer.css' />
<link type='text/css' rel='stylesheet' href='../apps/com.actionsoft.apps.coe.pal/lib/designer/themes/default/diagraming/ui.css' />
<link type='text/css' rel='stylesheet' href='../apps/com.actionsoft.apps.coe.pal/lib/designer/themes/default/diagraming/designer.versionCompare.css' />
<link rel="stylesheet" href="../commons/css/awsui.css">
<style>
.button.blue {
@ -93,6 +94,8 @@
<script type='text/javascript' src='../commons/js/public.js'></script>
<script type="text/javascript">
//公共信息
var wsId = "<#wsId>";
var teamId = "<#teamId>";
var browserId = "<#browserId>";// 浏览器唯一标识
var appId = "<#appId>";
var sessionId = "<#sid>";
@ -360,6 +363,102 @@
}
</script>
<!-- i18n -->
<script>
var 快速查询 = "<I18N#快速查询>";
var 已保存成功 = "<I18N#已保存成功>";
var 保存成功 = "<I18N#保存成功>";
var 页面中有未保存的内容请先保存 = "<I18N#页面中有未保存的内容请先保存>";
var 保存失败 = "<I18N#保存失败>";
var 列的第 = "<I18N#列的第>";
var 行不允许为空 = "<I18N#行不允许为空>";
var 文件属性 = "<I18N#文件属性>";
var 不允许为空 = "<I18N#不允许为空>";
var 返回 = "<I18N#返回>";
var 版本号 = "<I18N#版本号>";
var 吸色 = "<I18N#吸色>";
var 退出 = "<I18N#退出>";
var 当前颜色 = "<I18N#当前颜色>";
$(document).ready(function(){
$("#queryInput").attr("placeholder", 快速查询);
$("#back-vue-page-span").attr("awsui-qtip", 返回);
$("#toolbar_designer_version_no").attr("awsui-qtip", 版本号);
$("#color_draw").attr("awsui-qtip", 吸色 + "Esc" + 退出);
$("#color_show_now").attr("awsui-qtip", 当前颜色);
});
// designer.ui.debug.js i18n
var 颜色渐变 = "<I18N#颜色渐变>";
var 起始版本 = "<I18N#起始版本>";
var 错误个数 = "<I18N#错误个数>";
var 校验通过 = "<I18N#校验通过>";
var 文件过大不允许超过 = "<I18N#文件过大, 不允许超过>";
var 上传成功 = "<I18N#上传成功>";
var 正在加载预览 = "<I18N#正在加载预览>";
var 此地址下无法加载图片 = "<I18N#此地址下无法加载图片>";
var 请检查图片地址是否正确 = "<I18N#请检查图片地址是否正确>";
var 确保图片地址处于公开状态 = "<I18N#确保图片地址处于公开状态>";
var 正在加载图片 = "<I18N#正在加载图片>";
var 显示更多结果 = "<I18N#显示更多结果>";
var 正在应用图片请稍候 = "<I18N#正在应用图片请稍候>";
var 无法使用此图片请选择其他图片 = "<I18N#无法使用此图片请选择其他图片>";
var 页面中有未保存的内容请先保存 = "<I18N#页面中有未保存的内容请先保存>";
var 请稍后 = "<I18N#请稍后>";
var 请您先保存一个版本 = "<I18N#请您先保存一个版本>";
var 预览 = "<I18N#预览>";
var 图片创建完成 = "<I18N#图片创建完成>";
var 是否打开图片预览 = "<I18N#是否打开图片预览>";
var 导出完成 = "<I18N#导出完成>";
var 确定 = "<I18N#确定>";
var 关闭 = "<I18N#关闭>";
var 节点编号排序 = "<I18N#节点编号排序>";
var 提示 = "<I18N#提示>";
var 拖动排序确定后请保存设计器 = "<I18N#拖动排序确定后请保存设计器>";
var 无名称 = "<I18N#无名称>";
var 不支持编号排序 = "<I18N#不支持编号排序>";
var 画布没有形状或者形状没有编号属性 = "<I18N#画布没有形状或者形状没有编号属性>";
var 名称 = "<I18N#名称>";
var 节点号 = "<I18N#节点号>";
var 新发布 = "<I18N#新发布>";
var 变更 = "<I18N#变更>";
var 停用 = "<I18N#停用>";
var 暂无发布历史 = "<I18N#暂无发布历史>";
var 文件链接 = "<I18N#文件链接>";
var 自定义链接 = "<I18N#自定义链接>";
var 暂无链接 = "<I18N#暂无链接>";
var 处修改 = "<I18N#处修改>";
var 暂停 = "<I18N#暂停>";
var 从此版本播放 = "<I18N#从此版本播放>";
var 浏览器限制无法进入演示视图 = "<I18N#浏览器限制无法进入演示视图>";
var 无法进入全屏视图您可以按F11进入 = "<I18N#无法进入全屏视图您可以按(F11)进入>";
var 秒后自动保存 = "<I18N#秒后自动保存>";
var 修改 = "<I18N#修改>"
var 由 = "<I18N#>"
var 创建 = "<I18N#创建>"
var 新建版本 = "<I18N#新建版本>"
var 版本对比 = "<I18N#版本对比>"
var 切换该版本 = "<I18N#切换该版本>"
var 设计中 = "<I18N#设计中>"
var 已发布 = "<I18N#已发布>"
var 已停用 = "<I18N#已停用>"
var 审核中 = "<I18N#审核中>"
var 设计 = "<I18N#设计>"
var 是否继续切换 = "<I18N#是否继续切换>"
var 历史版本 = "<I18N#历史版本>"
var 提示 = "<I18N#提示>"
var 确定将 = "<I18N#确定将>"
var 版本为模板创建新版本文件 = "<I18N#版本为模板创建新版本文件>"
var 历史版本为模板创建新版本文件 = "<I18N#历史版本为模板创建新版本文件>"
var 请选择版本号 = "<I18N#请选择版本号>"
var 文件修改未保存 = "<I18N#文件修改未保存>"
var 文件已修改未保存 = "<I18N#文件已修改未保存>"
var 附件 = "<I18N#附件>"
var 形状属性 = "<I18N#形状属性>"
var 链接 = "<I18N#链接>"
</script>
<!-- 版本对比 -->
<script type='text/javascript' async charset='UTF-8' src='../apps/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/versionCompare/version.methods.debug.js'></script>
</head>
<body style="overflow:hidden;">
@ -370,9 +469,12 @@
<#checkoutTip>
<span class="diagram_title"><#fileName></span>
<div id="toolbar_wfversion_info" class="toolbar_info">
<div id="toolbar_designer_version_no" class="info version" awsui-qtip="版本管理">
<!-- <div id="toolbar_designer_version_no" class="info version" awsui-qtip="版本管理">
<#versionNum>
</div>
</div> -->
<span id="toolbar_designer_version_no" class="info version" style="cursor: pointer" awsui-qtip="版本号" onclick="versionListFun.openVersionList()">
<#versionNum>
</span>
<div id="toolbar_wfversion_info_status" style="display:none;" class="versioninfo version0" awsui-qtip="<#state>"><#state></div>
</div>
</div>