Merge branch 'apps_dev' of https://e.coding.net/yilidev/yilipalkaifa/apps into apps_dev

This commit is contained in:
lihongyu 2022-09-19 17:24:37 +08:00
commit 0d2bcc3f38
17 changed files with 411 additions and 152 deletions

View File

@ -355,7 +355,6 @@ public class BatchWeb extends ActionWeb {
if (sheet!=null){
//模型导入保存
new Thread(()->{new ImportShapeExcel1().execute(uc, object, simpleLogFile, fullLogFile, logId, methodCategory);}) .start();
// new ImportShapeExcel1().execute(uc, object, simpleLogFile, fullLogFile, logId, methodCategory);
}else {
new Thread(()->{new ImportShapeExcel().execute(uc, object, simpleLogFile, fullLogFile, logId, methodCategory);}) .start();
}

View File

@ -80,7 +80,7 @@ public class ImportShapeExcel1 {
LogUtil.appendLog("PAL 泳道图Excel批量导入模型 Begin " + UtilDate.datetimeFormat(startDate), simpleLogFile, fullLogFile);
LogUtil.appendLog("--------------------------------", simpleLogFile, fullLogFile);
LogUtil.appendLog("若模型存在多版本,只与模型使用中版本进行匹配,过往版本忽略不进行任何处理,若最新版本模型非可编辑状态(已发布、已停用、审批中),直接跳过该模型,不做任何调整", simpleLogFile, fullLogFile);
LogUtil.appendLog("若模型存在多版本,只与模型使用中版本进行匹配,过往版本忽略不进行任何处理,若使用中版本模型非可编辑状态(已发布、已停用、审批中),直接跳过该模型,不做任何调整", simpleLogFile, fullLogFile);
//前端入参table数据读取
JSONObject data = object.getJSONObject("data");
@ -121,7 +121,6 @@ public class ImportShapeExcel1 {
JSONObject drawBranchShape = this.drawBranchShape(repositoryId, branchData, offsetX, nodeMap, relationList);
double maxRight = drawBranchShape.getDouble("rightMaxLine");
int maxLevel = drawBranchShape.getInteger("maxLevel");
rightMaxLine = Math.max(rightMaxLine,maxRight);
offsetX = rightMaxLine + 150;
@ -187,7 +186,11 @@ public class ImportShapeExcel1 {
double offsetX = originOffsetX;
int maxLevelNum = 0;
//repositoryId
PALRepositoryModel palModel = PALRepositoryCache.getCache().get(repositoryId);
for (Map.Entry<String, Map<String, Map<String, List<CellObject>>>> branch : branchData.entrySet()) {
LogUtil.appendLog(BatchConst.LOG_DESC + "[执行阶段] 绘制["+ palModel.getName() +"] "+branch.getKey()+"分支图形", simpleLogFile, fullLogFile);
// <层级同级别map>
Map<String, Map<String, List<CellObject>>> levelMap = branch.getValue();
@ -245,6 +248,9 @@ public class ImportShapeExcel1 {
//节点画图,
JSONObject shape =this.drawShape(node, 0, offsetX, i, i);
if (null == shape){
continue;
}
//计算最右边界
rightMaxLine = this.getRightMaxLine(shape,rightMaxLine);
shapes.add(shape);
@ -307,6 +313,9 @@ public class ImportShapeExcel1 {
//绘制当前节点图形
JSONObject shape = this.drawShape(node, levelNodeIndex, offset, level, i);
if(null == shape){
continue;
}
LogUtil.appendLog(BatchConst.LOG_START + "[新增][" + node.getShapeName() + "]形状", simpleLogFile, fullLogFile);
LogUtil.appendLog(BatchConst.LOG_START + "[新增][" + node.getShapeName() + "]形状,形状类型[" + node.getShapeType() + "]", fullLogFile);
@ -349,6 +358,9 @@ public class ImportShapeExcel1 {
for (int level = 0; level < maxLevel; level++) {
//同层级多分支节点信息, <序号同序号listNode>
Map<String, List<CellObject>> numList = levelMap.get("" + level);
if (null == numList){
continue;
}
for (int i = 0; i < numList.keySet().size()+1; i++) {
//构建同层级的分支序号
@ -415,8 +427,8 @@ public class ImportShapeExcel1 {
for (int level = 0; level < maxLevel; level++) {
//同层级多分支节点信息, <序号同序号listNode>
Map<String, List<CellObject>> numList = levelMap.get("" + level);
if (numList.keySet().size()<=1){
//只调整分支节点
if (numList == null ){
//跳级处理,
continue;
}
//找到一个出现分支的层级
@ -646,6 +658,7 @@ public class ImportShapeExcel1 {
Map<String, List<CellObject>> numList = levelMap.get(level);
List<CellObject> upList = numList.get(level + "." + branch);
if (upList == null || upList.isEmpty()){
return leftLine;
@ -1244,13 +1257,16 @@ public class ImportShapeExcel1 {
}
private String getCellObjectUUID(CellObject node){
//名称+类型+序号
//名称+类型+序号+分支
return node.getShapeName()+"|"+node.getShapeType()+"|"+node.getShapeBranch()+"|"+node.getShapeNum();
}
private JSONObject drawShape(CellObject node,int levelNodeIndex,double offset,int level,int zIndex){
JSONObject shape = ShapeUtil.getProcessShapeDefinition("process.flowchart", node.getShapeType());
//
//特殊处理如果图形类型与图形不匹配
if(null == shape){
return shape;
}
shape.put("text", node.getShapeName());
shape.put("id", UUIDGener.getUUID());
shape.put("shapeNum", node.getShapeNum());
@ -1334,8 +1350,6 @@ public class ImportShapeExcel1 {
for (int rowIndex = 0; rowIndex < row.size(); rowIndex++) {
JSONObject cell = row.getJSONObject(rowIndex);
JSONArray expandArr = new JSONArray();
if (cell.getString("name").equals(ShapeConst.TABLE_SHAPE_BRANCH)){
//形状分支
branch = cell.getString("value");
@ -1360,8 +1374,7 @@ public class ImportShapeExcel1 {
cellObject.setShapeNum(cell.getString("value"));
}else {
//拓展属性
expandArr.add(cell);
cellObject.setExpandArr(expandArr);
cellObject.addExpandArr(cell);
}
}
@ -1497,7 +1510,6 @@ public class ImportShapeExcel1 {
list.addAll(upBranchNode);
}
return list;
}
@ -1544,58 +1556,17 @@ public class ImportShapeExcel1 {
Map<String, List<CellObject>> numMap = levelMap.get(level);
if (StringUtils.isEmpty(branch)){
//整数节点找父级节点
boolean flag = false;
for (String s : numMap.keySet()) {
if (null == numMap){
//出现跨级越级处理
List<JSONObject> list = this.find(StringUtils.isNotEmpty(branch) ? level +"."+ branch : level, levelMap, nodeMap); ;
upList.addAll(list);
}else{
if (StringUtils.isEmpty(branch)){
//整数节点找父级节点
boolean flag = false;
for (String s : numMap.keySet()) {
List<CellObject> nodes = numMap.get(s);
for (CellObject node : nodes) {
//计算最终确定位置map的key名称+类型+序号
String key = this.getCellObjectUUID(node);
List<JSONObject> shapes = nodeMap.get(key);
if (null != shapes){
for (JSONObject shape : shapes) {
if (!shape.get("name").equals("linker")){
upList.add(shape);
}
}
}
}
if (s.contains(".")){
//父级节点是分支下节点
flag = true;
}else {
flag = false;
}
}
if (flag){
//递归寻找多分支中整数节点的上级节点
List<JSONObject> list = this.find(level, levelMap, nodeMap);
//获取当前上级节点的list中的分支情况
List<String> upBranchNo = this.getUpBranchNo(upList);
if (!upBranchNo.isEmpty()){
for (JSONObject object : list) {
String shapeNum = object.getString("shapeNum");
if (shapeNum.contains(".")){
String branchNo = this.getBranchNo(shapeNum);
if (!upBranchNo.contains(branchNo)){
upList.add(object);
}
}
}
}
}
}else {
//分支节点找父级节点
List<CellObject> nodes = numMap.get(level +"."+ branch);
List<CellObject> nodes1 = numMap.get(level);
if ((nodes == null || nodes.isEmpty()) && (nodes1 == null || nodes1.isEmpty())){
List<JSONObject> list = this.find(level +"."+ branch, levelMap, nodeMap);
upList.addAll(list);
}else {
if (nodes!=null){
List<CellObject> nodes = numMap.get(s);
for (CellObject node : nodes) {
//计算最终确定位置map的key名称+类型+序号
String key = this.getCellObjectUUID(node);
@ -1608,25 +1579,73 @@ public class ImportShapeExcel1 {
}
}
}
if (s.contains(".")){
//父级节点是分支下节点
flag = true;
}else {
flag = false;
}
}
if (nodes1 != null){
for (CellObject node : nodes1) {
//计算最终确定位置map的key名称+类型+序号
String key = this.getCellObjectUUID(node);
List<JSONObject> shapes = nodeMap.get(key);
if (null != shapes){
for (JSONObject shape : shapes) {
if (!shape.get("name").equals("linker")){
upList.add(shape);
if (flag){
//递归寻找多分支中整数节点的上级节点
List<JSONObject> list = this.find(level, levelMap, nodeMap);
//获取当前上级节点的list中的分支情况
List<String> upBranchNo = this.getUpBranchNo(upList);
if (!upBranchNo.isEmpty()){
for (JSONObject object : list) {
String shapeNum = object.getString("shapeNum");
if (shapeNum.contains(".")){
String branchNo = this.getBranchNo(shapeNum);
if (!upBranchNo.contains(branchNo)){
upList.add(object);
}
}
}
}
}
}else {
//分支节点找父级节点
List<CellObject> nodes = numMap.get(level +"."+ branch);
List<CellObject> nodes1 = numMap.get(level);
if ((nodes == null || nodes.isEmpty()) && (nodes1 == null || nodes1.isEmpty())){
List<JSONObject> list = this.find(level +"."+ branch, levelMap, nodeMap);
upList.addAll(list);
}else {
if (nodes!=null){
for (CellObject node : nodes) {
//计算最终确定位置map的key名称+类型+序号
String key = this.getCellObjectUUID(node);
List<JSONObject> shapes = nodeMap.get(key);
if (null != shapes){
for (JSONObject shape : shapes) {
if (!shape.get("name").equals("linker")){
upList.add(shape);
}
}
}
}
}
if (nodes1 != null){
for (CellObject node : nodes1) {
//计算最终确定位置map的key名称+类型+序号
String key = this.getCellObjectUUID(node);
List<JSONObject> shapes = nodeMap.get(key);
if (null != shapes){
for (JSONObject shape : shapes) {
if (!shape.get("name").equals("linker")){
upList.add(shape);
}
}
}
}
}
}
}
}
return upList;
}

View File

@ -975,79 +975,6 @@ public class ValidShapeExcel {
}
}
// 查询一些形状定义
/*Map<String, List<JSONObject>> shapeObjMap = new HashMap<>();// 形状定义信息
Map<String, Map<String, String>> shapeMap = new HashMap<>();// 形状名称类型与id的映射关系
// 剩下的数据先获取下形状信息做进一步判断
iterator = excelShapeModels.iterator();
while (iterator.hasNext()) {
ExcelShapeModel row = iterator.next();
String repositoryName = row.getRepositoryName();
String repositoryType = row.getRepositoryType();
String key = repositoryName + "|||" + repositoryType;
String palId = repositoryMap.get(key);
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(palId);
List<JSONObject> shapeList = CoeDesignerUtil.getShapeMessageJson5(palId);
shapeObjMap.put(key, shapeList);
}*/
// 形状名称+类型的数量统计 key:key,value:key:shapeName+shapeType,value:count
/*Map<String, Map<String, Integer>> sameShapeMap = new HashMap<>();
for (Map.Entry<String, List<JSONObject>> entry : shapeObjMap.entrySet()) {
String key = entry.getKey();
List<JSONObject> shapeList = entry.getValue();
for (JSONObject shapeObj : shapeList) {
String shapeId = shapeObj.getString("id");
String shapeName = com.actionsoft.apps.coe.pal.pal.repository.designer.util.ShapeUtil.replaceBlank(shapeObj.getString("text")).replace(" ", "");
String shapeType = com.actionsoft.apps.coe.pal.pal.repository.designer.util.ShapeUtil.replaceBlank(shapeObj.getString("title")).replace(" ", "");
String shapeKey = shapeName + "|||" + shapeType;
// 形状名称+类型与对应的形状id映射记录
if (!shapeMap.containsKey(key)) {
shapeMap.put(key, new HashMap<>());
}
shapeMap.get(key).put(shapeKey, shapeId);
// 形状名称+类型的数量记录
if (!sameShapeMap.containsKey(key)) {
sameShapeMap.put(key, new HashMap<>());
}
if (!sameShapeMap.get(key).containsKey(shapeKey)) {
sameShapeMap.get(key).put(shapeKey, 0);
}
sameShapeMap.get(key).put(shapeKey, sameShapeMap.get(key).get(shapeKey) + 1);
}
}*/
// 7.模型形状存在但是出现了多个匹配
// 借用moreMatchList不再创建新的统一归为匹配出现多个类型
/*iterator = excelShapeModels.iterator();
while (iterator.hasNext()) {
ExcelShapeModel row = iterator.next();
String repositoryName = row.getRepositoryName();
String repositoryType = row.getRepositoryType();
String shapeName = row.getShapeName();
String shapeType = row.getShapeType();
String key = repositoryName + "|||" + repositoryType;
String palId = repositoryMap.get(key);
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(palId);
String shapeKey = shapeName + "|||" + shapeType;
if (sameShapeMap.containsKey(key) && sameShapeMap.get(key).containsKey(shapeKey) && sameShapeMap.get(key).get(shapeKey) > 1) {
RepositoryShapeInfoModel moreMatchModel = new RepositoryShapeInfoModel();
moreMatchModel.setRepositoryId(palId);
moreMatchModel.setRepositoryName(repositoryName);
moreMatchModel.setMethodName(repositoryType);
moreMatchModel.setMethodId(plModel.getMethodId());
moreMatchModel.setShapeName(shapeName);
moreMatchModel.setShapeType(shapeType);
moreMatchModel.setExcelShapeModel(row);
moreMatchModel.setResult("moreMatch");
moreMatchModel.setRowOk(false);
moreMatchModel.setRowMsg("出现PAL多个符合条件的模型形状");
moreMatchList.add(moreMatchModel);
iterator.remove();
}
}*/
// 剩下的都是基本信息校验通过的
List<RepositoryShapeInfoModel> matchShapeList = new ArrayList<>();
iterator = excelShapeModels.iterator();

View File

@ -2,6 +2,7 @@ package com.actionsoft.apps.coe.pal.batch.web.create.shape.model;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
/**
* 前后入参table解析后cell对象
@ -35,7 +36,7 @@ public class CellObject {
/**
* 拓展属性数组
*/
private JSONArray expandArr;
private JSONArray expandArr = new JSONArray();
public CellObject() {
}
@ -105,4 +106,8 @@ public class CellObject {
public void setExpandArr(JSONArray expandArr) {
this.expandArr = expandArr;
}
public void addExpandArr(JSONObject expand){
this.expandArr.add(expand);
}
}

View File

@ -500,6 +500,23 @@ public class PublisherController {
return web.queryMaPublishTreeData(type, wsId, teamId, flag, pid);
}
/**
* 根据当前环境返回wsid
* @param me
* @param type new change stop
* @param wsId
* @param teamId
* @return
*/
@Mapping("com.actionsoft.apps.coe.pal.publisher_publish_getWsId")
public String queryMaPublishTreeData(UserContext me) {
ProcessPublishWeb web = new ProcessPublishWeb(me);
return web.queryMaPublishGetWsId();
}
/**
* 快速查询定位到需要的发布流程
*

View File

@ -2117,6 +2117,29 @@ public class ProcessPublishWeb extends ActionWeb {
}
/**
* 根据当前许可环境获取当前wsid
* @return
*/
public String queryMaPublishGetWsId(){
ResponseObject ro = ResponseObject.newOkResponse();
String wsId = null;
boolean dev = Quota.isDEV();
if(dev==true){
wsId="0285ff6a-e418-4d8b-a5b1-22240296f769";
}
boolean prd=Quota.isPRD();
if(prd==true){
wsId="7d3ca852-a0bd-42e6-80b1-3dcea6f55083";
}
boolean qas=Quota.isQAS();
if(qas==true){
wsId="7d3ca852-a0bd-42e6-80b1-3dcea6f55083";
}
ro.put("wsId", wsId);
return ro.toString();
}
/**
* 快速查询定位树节点
*

View File

@ -43,12 +43,12 @@ public class PublishFormBeforeSaveEvent extends InterruptListener implements Int
@Override
public boolean execute(ProcessExecutionContext param) throws Exception {
List<BO> gridData=SDK.getBOAPI().query(PublisherConstant.BOSUBTABLE_N).bindId(param.getProcessInstance().getId()).list();
List<BO> gridNData=SDK.getBOAPI().query(PublisherConstant.BOSUBTABLE_N).bindId(param.getProcessInstance().getId()).list();
String bindid=param.getProcessInstance().getId();
StringBuilder sb = new StringBuilder();
StringBuilder sb1 = new StringBuilder();
if (gridData.size() > 0) {
for (BO rowData : gridData) {
if (gridNData.size() > 0) {
for (BO rowData : gridNData) {
//下面一行示例代码可以获取Ajax子表的每行记录的新建状态
String publishfileid = String.valueOf(rowData.getString("PUBLISHFILEID"));//注意isCreate并不是BO的一个字段该字段是有接口上层赋值的
@ -117,9 +117,87 @@ public class PublishFormBeforeSaveEvent extends InterruptListener implements Int
sb1 = sb.deleteCharAt(sb.length() - 1);
throw new BPMNError("0313", sb1.toString());
}
}
}
//发布变更
List<BO> gridCData=SDK.getBOAPI().query(PublisherConstant.BOSUBTABLE_C).bindId(param.getProcessInstance().getId()).list();
StringBuilder sb2 = new StringBuilder();
StringBuilder sb3 = new StringBuilder();
if (gridCData.size() > 0) {
for (BO rowData : gridCData) {
//下面一行示例代码可以获取Ajax子表的每行记录的新建状态
String publishfileid = String.valueOf(rowData.getString("CHANGEDFILEIDNEW"));//注意isCreate并不是BO的一个字段该字段是有接口上层赋值的
// 校验
PALRepositoryModel model = PALRepositoryCache.getCache().get(publishfileid);
if (model == null) {
throw new AWSException("没有找到文件:" + publishfileid);
}
PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao();
List<PALRepositoryPropertyModel> oldPropertyList = repositoryPropertyDao.getPropertysByPlid(publishfileid, "");
if (oldPropertyList != null && oldPropertyList.size() > 0) {
for (PALRepositoryPropertyModel propertyModel : oldPropertyList) {
//获取文件属性中支持文件
if(propertyModel.getPropertyId().equals("support_files")){
String relationFileId=JSONObject.parseObject(propertyModel.getPropertyValue()).getString("relationFileId");
String[] splitRelationFileId = new String[0];
//获取关联表单模型id
List<Map<String, Object>> fileElements;
if(UtilString.isNotEmpty(relationFileId)){
RowMap rerowMap= DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=?",relationFileId);
if(relationFileId.contains(",")){
splitRelationFileId=relationFileId.split(",");
fileElements = CoeDesignerUtil.getShapeMessageJson4(splitRelationFileId[0]);
RowMap rowMap=DBSql.getMap("SELECT T1.* FROM BO_ACT_COE_PUBLISH_C T1 LEFT JOIN APP_ACT_COE_PAL_REPOSITORY T2 on T1.CHANGEDFILEIDNEW=T2.ID WHERE T1.BINDID=? AND T1.CHANGEDFILEIDNEW=? AND T2.ISPUBLISH=0",bindid,splitRelationFileId[0]);
if(rowMap==null) {
sb2.append("模型名称:").append(model.getName()).append("关联文件模型名称:").append(rerowMap.getString("PLNAME")).append("需进行选择发布!").append("</br>");
}
}else{
fileElements = CoeDesignerUtil.getShapeMessageJson4(relationFileId);
RowMap rowMap=DBSql.getMap("SELECT T1.* FROM BO_ACT_COE_PUBLISH_C T1 LEFT JOIN APP_ACT_COE_PAL_REPOSITORY T2 on T1.CHANGEDFILEIDNEW=T2.ID WHERE T1.BINDID=? AND T1.CHANGEDFILEIDNEW=? AND T2.ISPUBLISH=0",bindid,relationFileId);
if(rowMap==null) {
sb2.append("模型名称:").append(model.getName()).append("关联文件模型名称:").append(rerowMap.getString("PLNAME")).append("需进行选择发布!").append("</br>");
}
}
for (Map<String, Object> shape : fileElements) {
String tempShapeId = shape.get("id").toString();
UpFileDao dao = new UpFileDao();
// 文件根据relationFileId 文件类型 查询
List<UpfileModel> list2;
if(relationFileId.contains(",")){
list2= dao.search(splitRelationFileId[0], tempShapeId, "s");
}else{
list2= dao.search(relationFileId, tempShapeId, "s");
}
if(list2.size()==0){
sb2.append(rowData.getString("PUBLISHFILENAME")).append("关联模型名称:").append("").append(shape.get("plName")).append("").append("节点名称:").append(""+shape.get("name")+"").append("未上传附件,请检查!!!").append(",");
}
}
}
}
}
}
if (sb2.length() > 0) {
sb3 = sb2.deleteCharAt(sb2.length() - 1);
throw new BPMNError("0313", sb3.toString());
}
}
}
return true;
}

View File

@ -33,6 +33,7 @@ var stopPageSetting = {
}
var isHighSecurity;
$(document).ready(function(){
getWsId();
$('td,th').css('padding-top','0px');
$('td,th').css('padding-bottom','0px');
// $('#alertMsg').css('background', '#fff');
@ -49,9 +50,31 @@ $(document).ready(function(){
initPagination();// 初始化页码
initOptButton();
// listenCloseEvent();// 关闭窗口执行,关闭窗口/刷新都会造成流程实例被删除,注释掉
})
});
//获取wsid
function getWsId() {
var param = {
sid : $("#sid").val(),
cmd : "com.actionsoft.apps.coe.pal.publisher_publish_getWsId"
}
$.ajax({
url : "./jd",
type : "POST",
dataType : "JSON",
data : param,
success : function(r) {
if (r.result == 'ok') {
var wsId=$("#WSID").val();
if(wsId==""){
$("#WSID").val(r.data.wsId);
}
}
}
});
}
var paginationSetting = {
pageLimit: pageLimit,
showItem: 10,

View File

@ -33,6 +33,7 @@ var stopPageSetting = {
}
var isHighSecurity;
$(document).ready(function(){
getWsId();
$('td,th').css('padding-top','0px');
$('td,th').css('padding-bottom','0px');
// $('#alertMsg').css('background', '#fff');
@ -51,6 +52,31 @@ $(document).ready(function(){
// listenCloseEvent();// 关闭窗口执行,关闭窗口/刷新都会造成流程实例被删除,注释掉
})
//获取wsid
function getWsId() {
var param = {
sid : $("#sid").val(),
cmd : "com.actionsoft.apps.coe.pal.publisher_publish_getWsId"
}
$.ajax({
url : "./jd",
type : "POST",
dataType : "JSON",
data : param,
success : function(r) {
if (r.result == 'ok') {
var wsId=$("#WSID").val();
if(wsId==""){
$("#WSID").val(r.data.wsId);
}
}
}
});
}
var paginationSetting = {
pageLimit: pageLimit,
showItem: 10,

View File

@ -0,0 +1,22 @@
package com.actionsoft.apps.coe.pal;
import com.actionsoft.apps.coe.pal.pal.modelconvert.ModelConvertWeb;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.bind.annotation.Controller;
import com.actionsoft.bpms.server.bind.annotation.Mapping;
@Controller
public class ModelConvertController {
@Mapping("com.actionsoft.apps.coe.pal.handle_epc_to_flowchart")
public String handleEpcToFlowChart(UserContext uc,String repositoryId,String sourceMethod,String targetMethod){
ModelConvertWeb modelConvertWeb = new ModelConvertWeb(uc);
return modelConvertWeb.handleEpcToFlowChart(repositoryId,sourceMethod,targetMethod);
}
@Mapping("com.actionsoft.apps.coe.pal.handle_epc_to_flowchart_batch")
public String handleEpcToFlowChartBatch(UserContext uc,String repositoryIds,String sourceMethod,String targetMethod){
ModelConvertWeb modelConvertWeb = new ModelConvertWeb(uc);
return modelConvertWeb.handleEpcToFlowChartBatch(repositoryIds,sourceMethod,targetMethod);
}
}

View File

@ -0,0 +1,46 @@
package com.actionsoft.apps.coe.pal.pal.modelconvert;
import com.actionsoft.apps.coe.pal.pal.modelconvert.constant.ModelConvertConst;
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.UUIDGener;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONArray;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class ModelConvertWeb extends ActionWeb {
private UserContext uc;
public ModelConvertWeb(UserContext uc) {
super(uc);
this.uc = uc;
}
public String handleEpcToFlowChart(String repositoryId,String sourceMethod,String targetMethod){
Map<String,Object> params = new HashMap<String, Object>();
params.put("sid",uc.getSessionId());
params.put("repositoryId",repositoryId);
params.put("sourceMethod",sourceMethod);
params.put("targetMethod",targetMethod);
ResponseObject ro = SDK.getAppAPI().callASLP(SDK.getAppAPI().getAppContext(ModelConvertConst.APP_ID), ModelConvertConst.ASLP_SINGLE_CONVERT, params);
return ro.toString();
}
public String handleEpcToFlowChartBatch(String repositoryIds,String sourceMethod,String targetMethod){
JSONArray array = JSONArray.parseArray(repositoryIds);
List<String> repositoryIdList = array.stream().map(id -> (String) id).collect(Collectors.toList());
Map<String,Object> params = new HashMap<String, Object>();
params.put("sid",uc.getSessionId());
params.put("repositoryId",repositoryIdList);
params.put("sourceMethod",sourceMethod);
params.put("targetMethod",targetMethod);
ResponseObject ro = SDK.getAppAPI().callASLP(SDK.getAppAPI().getAppContext(ModelConvertConst.APP_ID), ModelConvertConst.ASLP_SINGLE_CONVERT, params);
return ro.toString();
}
}

View File

@ -0,0 +1,13 @@
package com.actionsoft.apps.coe.pal.pal.modelconvert.constant;
public class ModelConvertConst {
// 模型转换应用ID
public static final String APP_ID = "com.actionsoft.apps.coe.pal.modelconvert";
// 单个模型转换的ASLP地址
public static final String ASLP_SINGLE_CONVERT = "aslp://com.actionsoft.apps.coe.pal.modelconvert/modelConvert";
// 批量模型转换的ASLP地址
public static final String ASLP_BATCH_CONVERT = "aslp://com.actionsoft.apps.coe.pal.modelconvert/modelConvertBatch";
}

View File

@ -1380,4 +1380,65 @@ public class ShapeUtil {
}
return result;
}
/**
* 获取流程节点定义
* @param methodId 类型
* @param shapeTitle 节点默认标题
* @return
*/
public static JSONObject getProcessShapeDefinition(String methodId, String shapeTitle) {
JSONArray shapes = CoeDesignerUtil.getShapeDefinition(methodId);
for (Object shape : shapes) {
JSONObject shapeObj = (JSONObject) shape;
if (shapeObj.containsKey("title")) {
if (methodId.contains("bpmn")) {
if (bpmnShapeScope().contains(shapeObj.getString("name")) && shapeObj.getString("title").equals(shapeTitle)) {
return shapeObj;
}
} else {
if (shapeObj.getString("title").equals(shapeTitle)) {
return shapeObj;
}
}
}
}
return null;
}
/**
* BPMN图并不全部使用给定范围
*/
private static List<String> bpmnShapeScope() {
List<String> list = new ArrayList<>();
list.add("startEvent");// 开始事件
list.add("messageStartEvent");// 消息开始事件
list.add("timerStartEvent");// 时间开始事件
list.add("signalStartEvent");// 信号开始事件
list.add("userTask");// 人工任务
list.add("serviceTask");// 服务任务
list.add("manualTask");// 手工任务
list.add("scriptTask");// 脚本任务
list.add("inclusiveGateway");// 包容网关
list.add("complexGateway");// 复杂网关
list.add("eventBasedGateway");// 事件网关
list.add("parallelGateway");// 并行网关
list.add("exclusiveGateway");// 排他网关
list.add("timerIntermediateCatchEvent");// 捕获时间事件
list.add("messageIntermediateCatchEvent");// 捕获消息事件
list.add("signalIntermediateCatchEvent");// 捕获信号事件
list.add("messageIntermediateThrowingEvent");// 抛出消息事件
list.add("signalIntermediateThrowingEvent");// 抛出信号事件
list.add("messageBoundaryInterrputingEvent");// 边界消息事件
list.add("signalBoundaryInterrputingEvent");// 边界信号事件
list.add("errorBoundaryInterrputingEvent");// 边界错误事件
list.add("endEvent");// 结束事件
list.add("terminateEndEvent");// 终止事件
list.add("messageEndEvent");// 消息结束事件
list.add("signalEndEvent");// 信号结束事件
list.add("errorEndEvent");// 错误结束事件
list.add("callActivityCallingProcess");// 调用子流程
list.add("group");//
// list.add("textAnnotation");// 注释
return list;
}
}

View File

@ -12049,7 +12049,7 @@ public String deleteReply(String replyid, String messageid) {
JSONArray methodIds = new JSONArray();
List<PALMethodModel> process = PALMethodCache.getPALMethodModelListByMethod("process");
for (PALMethodModel methodModel : process) {
if ("process.epc".equals(methodModel.getId()) || "process.bpmn2".equals(methodModel.getId())
if ("control.policy".equals(methodModel.getId()) || "process.epc".equals(methodModel.getId()) || "process.bpmn2".equals(methodModel.getId())
|| "process.flowchart".equals(methodModel.getId()) || "process.evc".equals(methodModel.getId())) {
JSONObject methodId = new JSONObject();
methodId.put("methodId",methodModel.getId());