调整自由模型名称
This commit is contained in:
parent
97e7030335
commit
cccee04375
@ -14,7 +14,6 @@ import java.text.Collator;
|
|||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -186,7 +185,6 @@ import com.actionsoft.sdk.local.api.PortalAPI;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
@ -2611,6 +2609,9 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
plLevel = plModel.getLevel();
|
plLevel = plModel.getLevel();
|
||||||
plOrderIndex = plModel.getOrderIndex();
|
plOrderIndex = plModel.getOrderIndex();
|
||||||
methodId = plModel.getMethodId();
|
methodId = plModel.getMethodId();
|
||||||
|
if ("freedom.allmethod".equals(methodId)){
|
||||||
|
macroLibraries.put("classification", I18nRes.findValue(CoEConstant.APP_ID, methodId));
|
||||||
|
}
|
||||||
for (int i = 0, methodSize = methodModels.size(); i < methodSize; i++) {
|
for (int i = 0, methodSize = methodModels.size(); i < methodSize; i++) {
|
||||||
PALMethodModel palMethodModel = methodModels.get(i);
|
PALMethodModel palMethodModel = methodModels.get(i);
|
||||||
String appId = palMethodModel.getId();
|
String appId = palMethodModel.getId();
|
||||||
@ -3798,32 +3799,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
String parentVersionId = model.getParentId();
|
String parentVersionId = model.getParentId();
|
||||||
List<PALRepositoryModel> list = dao.getAllRepositoryByVersionId(model.getVersionId()); // versionId相同的流程
|
List<PALRepositoryModel> list = dao.getAllRepositoryByVersionId(model.getVersionId()); // versionId相同的流程
|
||||||
PALRepositoryQueryAPIManager.getInstance().getAllPalRepositoryModelsByPid(model.getWsId(), model.getId(), list);
|
PALRepositoryQueryAPIManager.getInstance().getAllPalRepositoryModelsByPid(model.getWsId(), model.getId(), list);
|
||||||
// 同时将相关的角色图、绩效图也放入回收站
|
|
||||||
List<PALRepositoryModel> tmpList= new ArrayList<>();
|
|
||||||
List<PALRepositoryModel> allList = PALRepositoryCache.getListByWsId(model.getWsId());
|
|
||||||
Map<String, List<PALRepositoryModel>> mapByExt2 = allList.stream()
|
|
||||||
.filter(m -> "org.role".equals(m.getMethodId()) || "control.kpi".equals(m.getMethodId()))
|
|
||||||
.collect(Collectors.groupingBy(
|
|
||||||
m -> m.getExt2() != null ? m.getExt2() : "DEFAULT_KEY"
|
|
||||||
));
|
|
||||||
for (PALRepositoryModel removeModel : list) {
|
|
||||||
if ("process.bpmn2,process.epc,process.flowchart".contains(removeModel.getMethodId())) {
|
|
||||||
List data1 = new ArrayList();
|
|
||||||
data1.add(0, "org.role");
|
|
||||||
data1.add(1, removeModel.getId().trim());
|
|
||||||
List data2 = new ArrayList();
|
|
||||||
data2.add(0, "control.kpi");
|
|
||||||
data2.add(1, removeModel.getId().trim());
|
|
||||||
if (mapByExt2.containsKey(data1.toString())) {
|
|
||||||
tmpList.addAll(mapByExt2.get(data1.toString()));
|
|
||||||
}
|
|
||||||
if (mapByExt2.containsKey(data2.toString())) {
|
|
||||||
tmpList.addAll(mapByExt2.get(data2.toString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
list.addAll(tmpList);
|
|
||||||
|
|
||||||
Map<String, String> palMap = new HashMap<String, String>();
|
Map<String, String> palMap = new HashMap<String, String>();
|
||||||
List<PALRepositoryModel> removeList = new ArrayList<PALRepositoryModel>();
|
List<PALRepositoryModel> removeList = new ArrayList<PALRepositoryModel>();
|
||||||
for (PALRepositoryModel obj : list) {
|
for (PALRepositoryModel obj : list) {
|
||||||
@ -5468,7 +5443,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
private String copyAllFile(String wsId, String teamId, String sourceUUID, String targetUUID, int index) {
|
private String copyAllFile(String wsId, String teamId, String sourceUUID, String targetUUID, int index) {
|
||||||
ResponseObject ro = ResponseObject.newOkResponse();
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
PALRepositoryModel sourceModel = PALRepositoryCache.getCache().get(sourceUUID);
|
PALRepositoryModel sourceModel = PALRepositoryCache.getCache().get(sourceUUID);
|
||||||
String rostr = copyCurrentFile(wsId, teamId, sourceUUID, targetUUID, 0);
|
String rostr = copyCurrentFile(wsId, teamId, sourceUUID, targetUUID, index++);
|
||||||
List<PALRepositoryModel> subModelList = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getCoeProcessLevelByPid(sourceUUID, sourceModel.getWsId());
|
List<PALRepositoryModel> subModelList = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getCoeProcessLevelByPid(sourceUUID, sourceModel.getWsId());
|
||||||
if (subModelList != null && subModelList.size() > 0) {
|
if (subModelList != null && subModelList.size() > 0) {
|
||||||
for (PALRepositoryModel model : subModelList) {
|
for (PALRepositoryModel model : subModelList) {
|
||||||
@ -5575,11 +5550,15 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
int orderIndex = -1;
|
int orderIndex = -1;
|
||||||
Map<String, String> mapNewUUID = new HashMap<String, String>();
|
Map<String, String> mapNewUUID = new HashMap<String, String>();
|
||||||
boolean isCorrelate = PALRepositoryQueryAPIManager.getInstance().isCorrelateBpms(sourceModel.getId(), true);
|
boolean isCorrelate = PALRepositoryQueryAPIManager.getInstance().isCorrelateBpms(sourceModel.getId(), true);
|
||||||
List<PALRepositoryModel> sourceModels = CoeProcessLevelUtil.queryPalRepositoryModelsByPalId(sourceModel.getId());
|
List<PALRepositoryModel> models = CoeProcessLevelUtil.queryPalRepositoryModelsByPalId(sourceModel.getId());
|
||||||
Collections.sort(sourceModels, (o1, o2) -> VersionUtil.compareVersionNo(o1.getVersion(), o2.getVersion(), false));
|
Collections.sort(models, new Comparator<PALRepositoryModel>() {
|
||||||
Map<String, String> repositoryOldNewMap = new HashMap<String, String>();// 记录原来的流程版本与新的流程版本
|
@Override
|
||||||
// int version = 1;
|
public int compare(PALRepositoryModel o1, PALRepositoryModel o2) {
|
||||||
for (PALRepositoryModel sourceVerModel : sourceModels) {
|
return VersionUtil.compareVersionNo(o1.getVersion(), o2.getVersion(), true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
int version = 1;
|
||||||
|
for (PALRepositoryModel oldModel : models) {
|
||||||
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||||
PALRepositoryModelImpl newModel = new PALRepositoryModelImpl();
|
PALRepositoryModelImpl newModel = new PALRepositoryModelImpl();
|
||||||
|
|
||||||
@ -5609,53 +5588,53 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
|
|
||||||
newModel.setVersionId(versionId);
|
newModel.setVersionId(versionId);
|
||||||
newModel.setPlRid(plRid);
|
newModel.setPlRid(plRid);
|
||||||
newModel.setVersion(sourceVerModel.getVersion());
|
newModel.setVersion(version);
|
||||||
newModel.setHistoryMaxVersion("0");
|
newModel.setHistoryMaxVersion("0");
|
||||||
if (sourceVerModel.getId().equals(sourceVerModel.getVersionId())) {
|
if (version == 1) {
|
||||||
newModel.setId(versionId);
|
newModel.setId(versionId);
|
||||||
|
newModel.setUse(true);
|
||||||
} else {
|
} else {
|
||||||
newModel.setId(UUIDGener.getUUID());
|
newModel.setId(UUIDGener.getUUID());
|
||||||
|
newModel.setUse(false);
|
||||||
}
|
}
|
||||||
newModel.setUse(sourceVerModel.isUse());
|
|
||||||
//如果为绩效图则复制文本到相应文件夹中
|
//如果为绩效图则复制文本到相应文件夹中
|
||||||
if (targetUUID.equals("control")) {
|
if (targetUUID.equals("control")) {
|
||||||
targetUUID = sourceModel.getParentId();
|
targetUUID = sourceModel.getParentId();
|
||||||
}
|
}
|
||||||
newModel.setParentId(targetUUID);
|
newModel.setParentId(targetUUID);
|
||||||
newModel.setNo(plNo);
|
newModel.setNo(plNo);
|
||||||
newModel.setMethodId(sourceVerModel.getMethodId());
|
newModel.setMethodId(oldModel.getMethodId());
|
||||||
newModel.setMethodCategory(sourceVerModel.getMethodCategory());
|
newModel.setMethodCategory(oldModel.getMethodCategory());
|
||||||
newModel.setMilestone(sourceVerModel.getMilestone());
|
newModel.setMilestone(oldModel.getMilestone());
|
||||||
if (orderIndex == -1) {
|
if (orderIndex == -1) {
|
||||||
orderIndex = coeProcessLevel.getChildrenMaxOrderIndexByPidAndWsId(targetUUID, wsId);
|
orderIndex = coeProcessLevel.getChildrenMaxOrderIndexByPidAndWsId(targetUUID, wsId);
|
||||||
}
|
}
|
||||||
newModel.setOrderIndex(orderIndex + 1);
|
newModel.setOrderIndex(orderIndex + 1);
|
||||||
newModel.setName(sourceVerModel.getName() + (index == 0 ? "(副本)" : ""));
|
newModel.setName(oldModel.getName() + (index == 0 ? "(副本)" : ""));
|
||||||
String uid = super.getContext().getUID();
|
String uid = super.getContext().getUID();
|
||||||
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
||||||
newModel.setCreateUser(uid);
|
newModel.setCreateUser(uid);
|
||||||
newModel.setCreateDate(nowTime);
|
newModel.setCreateDate(nowTime);
|
||||||
newModel.setModifyUser(uid);
|
newModel.setModifyUser(uid);
|
||||||
newModel.setModifyDate(nowTime);
|
newModel.setModifyDate(nowTime);
|
||||||
newModel.setBottomLevel(sourceVerModel.isBottomLevel());
|
newModel.setBottomLevel(oldModel.isBottomLevel());
|
||||||
newModel.setDesc(sourceVerModel.getDesc());
|
newModel.setDesc(oldModel.getDesc());
|
||||||
newModel.setInput(sourceVerModel.getInput());
|
newModel.setInput(oldModel.getInput());
|
||||||
newModel.setOutput(sourceVerModel.getOutput());
|
newModel.setOutput(oldModel.getOutput());
|
||||||
newModel.setExecType(sourceVerModel.getExecType());
|
newModel.setExecType(oldModel.getExecType());
|
||||||
newModel.setSystemFile(false);
|
newModel.setSystemFile(false);
|
||||||
newModel.setSystemName(sourceVerModel.getSystemName());
|
newModel.setSystemName(oldModel.getSystemName());
|
||||||
newModel.setPublish(false);
|
newModel.setPublish(false);
|
||||||
newModel.setStop(false);
|
newModel.setStop(false);
|
||||||
newModel.setApproval(false);
|
newModel.setApproval(false);
|
||||||
newModel.setDutyDept(sourceVerModel.getDutyDept());
|
newModel.setDutyDept(oldModel.getDutyDept());
|
||||||
newModel.setDutyUser(sourceVerModel.getDutyUser());
|
newModel.setDutyUser(oldModel.getDutyUser());
|
||||||
newModel.setExt1(sourceVerModel.getExt1());
|
newModel.setExt1(oldModel.getExt1());
|
||||||
newModel.setExt2(sourceVerModel.getExt2());
|
newModel.setExt2(oldModel.getExt2());
|
||||||
newModel.setExt3(sourceVerModel.getExt3());
|
newModel.setExt3(oldModel.getExt3());
|
||||||
//设置ext4不进行复制
|
//设置ext4不进行复制
|
||||||
newModel.setExt4("");
|
newModel.setExt4("");
|
||||||
// version++;
|
version++;
|
||||||
repositoryOldNewMap.put(sourceVerModel.getId(), newModel.getId());
|
|
||||||
// 创建
|
// 创建
|
||||||
try {
|
try {
|
||||||
coeProcessLevel.insert(newModel);
|
coeProcessLevel.insert(newModel);
|
||||||
@ -5671,13 +5650,13 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
}
|
}
|
||||||
CoeProcessLevelNoCache.getInstance().reloadInBackground(targetWsId); // 重新装载编号
|
CoeProcessLevelNoCache.getInstance().reloadInBackground(targetWsId); // 重新装载编号
|
||||||
if (!isCorrelate) {// PAL流程
|
if (!isCorrelate) {// PAL流程
|
||||||
if (!UtilString.isEmpty(newModel.getFilePath()) && !UtilString.isEmpty(sourceVerModel.getFilePath())) {
|
if (!UtilString.isEmpty(newModel.getFilePath()) && !UtilString.isEmpty(oldModel.getFilePath())) {
|
||||||
CoeFile fileUtil = new CoeFile();
|
CoeFile fileUtil = new CoeFile();
|
||||||
fileUtil.copyDefaultVersion(sourceVerModel.getFilePath(), sourceVerModel.getId(), newModel.getFilePath(), newModel.getId());
|
fileUtil.copyDefaultVersion(oldModel.getFilePath(), oldModel.getId(), newModel.getFilePath(), newModel.getId());
|
||||||
CoeDesignerImageCache.getCache().put(newModel.getId(), newModel.getId());// 图片更新记录缓存
|
CoeDesignerImageCache.getCache().put(newModel.getId(), newModel.getId());// 图片更新记录缓存
|
||||||
}
|
}
|
||||||
} else {// PAL与BPMS关联流程,从BPMS端获取数据
|
} else {// PAL与BPMS关联流程,从BPMS端获取数据
|
||||||
CoeProcessLevelCorrelateModel model = CoeProcessLevelCorrelateCache.getCache().get(sourceVerModel.getId());
|
CoeProcessLevelCorrelateModel model = CoeProcessLevelCorrelateCache.getCache().get(oldModel.getId());
|
||||||
if (model != null && model.isCorrelate()) {
|
if (model != null && model.isCorrelate()) {
|
||||||
ProcessDefinition processDefinition = ProcessDefCache.getInstance().get(model.getPlAwsId());
|
ProcessDefinition processDefinition = ProcessDefCache.getInstance().get(model.getPlAwsId());
|
||||||
if (processDefinition != null) {
|
if (processDefinition != null) {
|
||||||
@ -5699,12 +5678,12 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mapNewUUID = createShapeIdRelation(sourceVerModel, mapNewUUID, true);
|
mapNewUUID = createShapeIdRelation(oldModel, mapNewUUID, true);
|
||||||
// 更新流程文件中节点id等信息
|
// 更新流程文件中节点id等信息
|
||||||
updateDefineShape(newModel, mapNewUUID, "");
|
updateDefineShape(newModel, mapNewUUID, "");
|
||||||
//CoeProcessLevelUtil.copyRepositoryProperty(oldModel, newModel, mapNewUUID, _uc);
|
//CoeProcessLevelUtil.copyRepositoryProperty(oldModel, newModel, mapNewUUID, _uc);
|
||||||
//ydq 修改
|
//ydq 修改
|
||||||
CoeProcessLevelUtil.copyRepositoryProperty(sourceVerModel, newModel, mapNewUUID, _uc,true);
|
CoeProcessLevelUtil.copyRepositoryProperty(oldModel, newModel, mapNewUUID, _uc,true);
|
||||||
//ydq 修改结束
|
//ydq 修改结束
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -5714,265 +5693,8 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
String finalTargetUUID = targetUUID;
|
String finalTargetUUID = targetUUID;
|
||||||
// 创建的副本进行权限处理
|
// 创建的副本进行权限处理
|
||||||
CoeCooperationAPIManager.getInstance().updateCooperationPerm(_uc, "复制", teamId, finalTargetUUID, versionId);
|
CoeCooperationAPIManager.getInstance().updateCooperationPerm(_uc, "复制", teamId, finalTargetUUID, versionId);
|
||||||
List<PALRepositoryModel> newVerModels = PALRepositoryCache.getByVersionId(versionId);
|
|
||||||
String useId = null;
|
|
||||||
for (PALRepositoryModel model : newVerModels) {
|
|
||||||
if (model.isUse()) {
|
|
||||||
useId = model.getId();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (useId == null) {// 若没有使用中模型,例如流程有3个版本,角色图有2个版本,如果恰好使用中的流程版本没有角色图,则2个角色图都是非使用中
|
|
||||||
useId = newVerModels.get(0).getId();
|
|
||||||
}
|
|
||||||
ro.put("mapNewUUID", mapNewUUID);
|
ro.put("mapNewUUID", mapNewUUID);
|
||||||
ro.put("repositoryOldNewMap", repositoryOldNewMap);
|
ro.put("useId", CoeProcessLevelDaoFacotory.createCoeProcessLevel().getCoeUseProcessLevelByRid(plRid).get(0).getId());
|
||||||
ro.put("useId", useId);
|
|
||||||
System.out.println("模型复制结果:" + repositoryOldNewMap);
|
|
||||||
// 对流程涉及到的角色图、绩效图进行复制处理
|
|
||||||
// 看是否有用角色图、绩效图
|
|
||||||
if (existingModels(new ArrayList<String>(repositoryOldNewMap.keySet()), "org.role")) {// 有角色图
|
|
||||||
System.out.println("复制流程图[" + sourceModel.getName() + "]时检测到有相关角色图,开始进行角色图复制...");
|
|
||||||
copyPalProcessLevelRoleCorrelationModelRepository(repositoryOldNewMap, mapNewUUID);
|
|
||||||
System.out.println("复制流程图[" + sourceModel.getName() + "]时检测到有相关角色图,角色图复制完成!");
|
|
||||||
}
|
|
||||||
if (existingModels(new ArrayList<String>(repositoryOldNewMap.keySet()), "control.kpi")) {// 有绩效图
|
|
||||||
System.out.println("复制流程图[" + sourceModel.getName() + "]时检测到有相关绩效图,开始进行绩效图复制...");
|
|
||||||
copyPalProcessLevelPerformanceCorrelationModelRepository(repositoryOldNewMap, mapNewUUID);
|
|
||||||
System.out.println("复制流程图[" + sourceModel.getName() + "]时检测到有相关绩效图,绩效图复制完成!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 绩效图复制
|
|
||||||
* @param repositoryOldNewMap – 复制的流程图旧新id关系
|
|
||||||
* @param mapNewUUID – 复制的流程图的节点旧新id关系
|
|
||||||
*/
|
|
||||||
private String copyPalProcessLevelPerformanceCorrelationModelRepository(Map<String, String> repositoryOldNewMap, Map<String, String> mapNewUUID) {
|
|
||||||
ResponseObject ro = ResponseObject.newOkResponse();
|
|
||||||
PALRepository repositoryDao = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
|
||||||
DesignerShapeRelationDao relationDao = new DesignerShapeRelationDao();
|
|
||||||
// 找出对应的角色图使用版本
|
|
||||||
String performanceId = null;
|
|
||||||
PALRepositoryModel usePerformanceModel = null;
|
|
||||||
for (String uuid : repositoryOldNewMap.keySet()) {
|
|
||||||
performanceId = getExistingModel(uuid, "control.kpi");
|
|
||||||
if (UtilString.isNotEmpty(performanceId)) {
|
|
||||||
System.out.println("找到了流程与之关联的任一绩效图[" + performanceId + "]");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (UtilString.isEmpty(performanceId)) {
|
|
||||||
System.out.println("没有找到流程与之关联的绩效图");
|
|
||||||
return ro.toString();
|
|
||||||
}
|
|
||||||
PALRepositoryModel performanceModel = PALRepositoryCache.getCache().get(performanceId);
|
|
||||||
List<PALRepositoryModel> performanceModels = PALRepositoryCache.getCache().getByVersionId(performanceModel.getVersionId());
|
|
||||||
for (PALRepositoryModel r : performanceModels) {
|
|
||||||
if (r.isUse()) {
|
|
||||||
usePerformanceModel = r;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (usePerformanceModel == null) {
|
|
||||||
System.out.println("没有找到流程与之关联的绩效图使用版本,默认使用最小版本号的绩效版本开始进行角色复制");
|
|
||||||
Collections.sort(performanceModels, (o1, o2) -> VersionUtil.compareVersionNo(o1.getVersion(), o2.getVersion(), false));
|
|
||||||
usePerformanceModel = performanceModels.get(0);
|
|
||||||
}
|
|
||||||
// 对绩效图使用版本进行复制
|
|
||||||
String copyRoleResult = copyFile(usePerformanceModel.getWsId(), null, usePerformanceModel.getId(), usePerformanceModel.getParentId(), "self");
|
|
||||||
if (!JSONObject.parseObject(copyRoleResult).get("result").equals("ok")) {
|
|
||||||
System.out.println("复制绩效图[" + performanceModel.getName() + "]时出现错误,请检查!");
|
|
||||||
return copyRoleResult;
|
|
||||||
}
|
|
||||||
Map<String, String> performanceRepositoryOldNewMap = (Map<String, String>) JSONObject.parseObject(copyRoleResult).getJSONObject("data").get("repositoryOldNewMap");
|
|
||||||
Map<String, String> performanceMapNewUUID = (Map<String, String>) JSONObject.parseObject(copyRoleResult).getJSONObject("data").get("mapNewUUID");
|
|
||||||
// 建立新的关联关系
|
|
||||||
for (Map.Entry<String, String> entry : performanceRepositoryOldNewMap.entrySet()) {
|
|
||||||
List<DesignerShapeRelationModel> insertRelationList = new ArrayList<>();
|
|
||||||
String oldPerformanceId = entry.getKey();
|
|
||||||
String newPerformanceId = entry.getValue();
|
|
||||||
PALRepositoryModel newPerformanceModel = PALRepositoryCache.getCache().get(newPerformanceId);
|
|
||||||
String ext2 = newPerformanceModel.getExt2();
|
|
||||||
// 1. 去除方括号
|
|
||||||
String content = ext2.substring(1, ext2.length() - 1);
|
|
||||||
// 2. 分割字符串并处理空格
|
|
||||||
List<String> ext2List = Arrays.stream(content.split(",")).map(String::trim).collect(Collectors.toList());
|
|
||||||
String oldProcessId = ext2List.get(1);
|
|
||||||
if (repositoryOldNewMap.containsKey(oldProcessId)) {
|
|
||||||
List dataList = new ArrayList();
|
|
||||||
dataList.add(0, "control.kpi");
|
|
||||||
dataList.add(1, repositoryOldNewMap.get(oldProcessId));
|
|
||||||
// 更新模型关系
|
|
||||||
repositoryDao.updateRepositoryExt2(newPerformanceId, dataList.toString());
|
|
||||||
System.out.println("更新绩效图[" + newPerformanceModel.getName() + "]的关联关系,新的绩效图[" + newPerformanceId + "]关联的新流程图[" + repositoryOldNewMap.get(oldProcessId) + "]");
|
|
||||||
List<DesignerShapeRelationModel> oldRelationModels = DesignerShapeRelationCache.getListByFileIdAndAttrIdAndRelationFileId(oldProcessId, "Process_performance_metrics", oldPerformanceId);
|
|
||||||
for (DesignerShapeRelationModel relationModel : oldRelationModels) {
|
|
||||||
String processShapeId = relationModel.getShapeId();
|
|
||||||
String performanceShapeId = relationModel.getRelationShapeId();
|
|
||||||
if (performanceMapNewUUID.containsKey(performanceShapeId)) {
|
|
||||||
// 创建新的关联关系
|
|
||||||
DesignerShapeRelationModel newRelationModel = new DesignerShapeRelationModel();
|
|
||||||
newRelationModel.setId(UUIDGener.getUUID());
|
|
||||||
newRelationModel.setFileId(repositoryOldNewMap.get(oldProcessId));
|
|
||||||
newRelationModel.setShapeId("");
|
|
||||||
newRelationModel.setShapeText(relationModel.getShapeText());
|
|
||||||
newRelationModel.setAttrId(relationModel.getAttrId());
|
|
||||||
newRelationModel.setRelationFileId(newPerformanceId);
|
|
||||||
newRelationModel.setRelationShapeId(performanceMapNewUUID.get(performanceShapeId));
|
|
||||||
newRelationModel.setRelationShapeText(relationModel.getRelationShapeText());
|
|
||||||
insertRelationList.add(newRelationModel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (insertRelationList.size() > 0) {
|
|
||||||
relationDao.barchInsert(insertRelationList);
|
|
||||||
System.out.println("绩效图[" + newPerformanceModel.getName() + "]关联的流程图[" + repositoryOldNewMap.get(oldProcessId) + "]节点关系复制完成!");
|
|
||||||
System.out.println("复制的节点关系:" + insertRelationList.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ro.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 角色图复制
|
|
||||||
* @param repositoryOldNewMap 复制的流程图旧新id关系
|
|
||||||
* @param mapNewUUID 复制的流程图的节点旧新id关系
|
|
||||||
*/
|
|
||||||
private String copyPalProcessLevelRoleCorrelationModelRepository(Map<String, String> repositoryOldNewMap, Map<String, String> mapNewUUID) {
|
|
||||||
ResponseObject ro = ResponseObject.newOkResponse();
|
|
||||||
PALRepository repositoryDao = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
|
||||||
DesignerShapeRelationDao relationDao = new DesignerShapeRelationDao();
|
|
||||||
// 找出对应的角色图使用版本
|
|
||||||
String roleId = null;
|
|
||||||
PALRepositoryModel useRoleModel = null;
|
|
||||||
for (String uuid : repositoryOldNewMap.keySet()) {
|
|
||||||
roleId = getExistingModel(uuid, "org.role");
|
|
||||||
if (UtilString.isNotEmpty(roleId)) {
|
|
||||||
System.out.println("找到了流程与之关联的任一角色图[" + roleId + "]");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (UtilString.isEmpty(roleId)) {
|
|
||||||
System.out.println("没有找到流程与之关联的角色图");
|
|
||||||
return ro.toString();
|
|
||||||
}
|
|
||||||
PALRepositoryModel roleModel = PALRepositoryCache.getCache().get(roleId);
|
|
||||||
List<PALRepositoryModel> roleModels = PALRepositoryCache.getCache().getByVersionId(roleModel.getVersionId());
|
|
||||||
for (PALRepositoryModel r : roleModels) {
|
|
||||||
if (r.isUse()) {
|
|
||||||
useRoleModel = r;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (useRoleModel == null) {
|
|
||||||
System.out.println("没有找到流程与之关联的角色图使用版本,默认使用最小版本号的角色版本开始进行角色复制");
|
|
||||||
Collections.sort(roleModels, (o1, o2) -> VersionUtil.compareVersionNo(o1.getVersion(), o2.getVersion(), false));
|
|
||||||
useRoleModel = roleModels.get(0);
|
|
||||||
}
|
|
||||||
// 对角色图使用版本进行复制
|
|
||||||
String copyRoleResult = copyFile(useRoleModel.getWsId(), null, useRoleModel.getId(), useRoleModel.getParentId(), "self");
|
|
||||||
if (!JSONObject.parseObject(copyRoleResult).get("result").equals("ok")) {
|
|
||||||
System.out.println("复制角色图[" + roleModel.getName() + "]时出现错误,请检查!");
|
|
||||||
return copyRoleResult;
|
|
||||||
}
|
|
||||||
Map<String, String> roleRepositoryOldNewMap = (Map<String, String>) JSONObject.parseObject(copyRoleResult).getJSONObject("data").get("repositoryOldNewMap");
|
|
||||||
Map<String, String> roleMapNewUUID = (Map<String, String>) JSONObject.parseObject(copyRoleResult).getJSONObject("data").get("mapNewUUID");
|
|
||||||
// 建立新的关联关系
|
|
||||||
for (Map.Entry<String, String> entry : roleRepositoryOldNewMap.entrySet()) {
|
|
||||||
List<DesignerShapeRelationModel> insertRelationList = new ArrayList<>();
|
|
||||||
String oldRoleId = entry.getKey();
|
|
||||||
String newRoleId = entry.getValue();
|
|
||||||
PALRepositoryModel newRoleModel = PALRepositoryCache.getCache().get(newRoleId);
|
|
||||||
String ext2 = newRoleModel.getExt2();
|
|
||||||
// 1. 去除方括号
|
|
||||||
String content = ext2.substring(1, ext2.length() - 1);
|
|
||||||
// 2. 分割字符串并处理空格
|
|
||||||
List<String> ext2List = Arrays.stream(content.split(",")).map(String::trim).collect(Collectors.toList());
|
|
||||||
String oldProcessId = ext2List.get(1);
|
|
||||||
if (repositoryOldNewMap.containsKey(oldProcessId)) {
|
|
||||||
List dataList = new ArrayList();
|
|
||||||
dataList.add(0, "org.role");
|
|
||||||
dataList.add(1, repositoryOldNewMap.get(oldProcessId));
|
|
||||||
// 更新模型关系
|
|
||||||
repositoryDao.updateRepositoryExt2(newRoleId, dataList.toString());
|
|
||||||
System.out.println("更新角色图[" + newRoleModel.getName() + "]的关联关系,新的角色图[" + newRoleId + "]关联的新流程图[" + repositoryOldNewMap.get(oldProcessId) + "]");
|
|
||||||
List<DesignerShapeRelationModel> oldRelationModels = DesignerShapeRelationCache.getListByFileIdAndAttrIdAndRelationFileId(oldProcessId, "role", oldRoleId);
|
|
||||||
for (DesignerShapeRelationModel relationModel : oldRelationModels) {
|
|
||||||
String processShapeId = relationModel.getShapeId();
|
|
||||||
String roleShapeId = relationModel.getRelationShapeId();
|
|
||||||
if (mapNewUUID.containsKey(processShapeId) && roleMapNewUUID.containsKey(roleShapeId)) {
|
|
||||||
// 创建新的关联关系
|
|
||||||
DesignerShapeRelationModel newRelationModel = new DesignerShapeRelationModel();
|
|
||||||
newRelationModel.setId(UUIDGener.getUUID());
|
|
||||||
newRelationModel.setFileId(repositoryOldNewMap.get(oldProcessId));
|
|
||||||
newRelationModel.setShapeId(mapNewUUID.get(processShapeId));
|
|
||||||
newRelationModel.setShapeText(relationModel.getShapeText());
|
|
||||||
newRelationModel.setAttrId(relationModel.getAttrId());
|
|
||||||
newRelationModel.setRelationFileId(newRoleId);
|
|
||||||
newRelationModel.setRelationShapeId(roleMapNewUUID.get(roleShapeId));
|
|
||||||
newRelationModel.setRelationShapeText(relationModel.getRelationShapeText());
|
|
||||||
insertRelationList.add(newRelationModel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (insertRelationList.size() > 0) {
|
|
||||||
relationDao.barchInsert(insertRelationList);
|
|
||||||
System.out.println("角色图[" + newRoleModel.getName() + "]关联的流程图[" + repositoryOldNewMap.get(oldProcessId) + "]节点关系复制完成!");
|
|
||||||
System.out.println("复制的节点关系:" + insertRelationList.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ro.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断是否存在相关的角色图、绩效图
|
|
||||||
* @param uuidList
|
|
||||||
* @param methodId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private boolean existingModels(List<String> uuidList, String methodId) {
|
|
||||||
for (String uuid : uuidList) {
|
|
||||||
if (getExistingModel(uuid, methodId) != null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取已经存在的流程相关联的模型,例如流程关联的角色图
|
|
||||||
* @param uuid 流程Id
|
|
||||||
* @param methodId 对应的建模方法ID
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private String getExistingModel(String uuid, String methodId) {
|
|
||||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(uuid);
|
|
||||||
if (model == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// 1.查询有关联的methodId模型
|
|
||||||
List<String> paramList = new ArrayList<>();
|
|
||||||
List data = new ArrayList();
|
|
||||||
data.add(0, methodId.trim());
|
|
||||||
data.add(1, model.getId().trim());
|
|
||||||
String param = data.toString();// 查询参数
|
|
||||||
paramList.add(param);
|
|
||||||
// 2.查询符合的methodId模型列表并排序(理论上只会有一个)
|
|
||||||
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
|
||||||
List<PALRepositoryModel> list = coeProcessLevel.searchRepositoryByMethodIdAndExt2(methodId, paramList);
|
|
||||||
if (CollectionUtils.isNotEmpty(list)) {
|
|
||||||
list.sort((m1,m2) -> {
|
|
||||||
if (m1.getVersion() == m2.getVersion()) {
|
|
||||||
return m1.getCreateDate().compareTo(m2.getCreateDate());
|
|
||||||
}
|
|
||||||
return m1.getVersion() > m2.getVersion() ? 1 : -1;
|
|
||||||
});
|
|
||||||
// 3.取排在首位的角色模型的模型ID
|
|
||||||
return list.get(0).getId();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDefineShape(PALRepositoryModelImpl newModel, Map<String, String> mapNewUUID, String define) {
|
private void updateDefineShape(PALRepositoryModelImpl newModel, Map<String, String> mapNewUUID, String define) {
|
||||||
@ -8623,12 +8345,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
* @param methodId
|
* @param methodId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getPalProcessLevelCreateMethodList(String category, String methodId) {
|
public String getPalProcessLevelCreateMethodList(String category, String methodId, String fileId) {
|
||||||
if(!"process.framework".equals(methodId) && !"default".equals(methodId)){//不是架构,或者文件夹
|
|
||||||
ResponseObject ro = ResponseObject.newErrResponse();
|
|
||||||
ro.msg("methodId:"+methodId+"当前所选择目录不是文件夹或者流程架构,请选择正确的目录!");
|
|
||||||
return ro.toString();
|
|
||||||
}
|
|
||||||
ResponseObject ro = ResponseObject.newOkResponse();
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
JSONArray fileArr = new JSONArray();// 文件类模型,可以画图
|
JSONArray fileArr = new JSONArray();// 文件类模型,可以画图
|
||||||
JSONArray folderArr = new JSONArray();// 文件夹类模型,作为文件夹
|
JSONArray folderArr = new JSONArray();// 文件夹类模型,作为文件夹
|
||||||
@ -8664,18 +8381,29 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
methodObj.put("categoryName", I18nRes.findValue(CoEConstant.APP_ID, c));
|
methodObj.put("categoryName", I18nRes.findValue(CoEConstant.APP_ID, c));
|
||||||
methodObj.put("method", model.getId());
|
methodObj.put("method", model.getId());
|
||||||
methodObj.put("methodName", I18nRes.findValue(CoEConstant.APP_ID, model.getId()));
|
methodObj.put("methodName", I18nRes.findValue(CoEConstant.APP_ID, model.getId()));
|
||||||
if (model.getSchema().contains("架构KPI图")) {
|
if (!"process.yilifreedommodel".equals(model.getId())){
|
||||||
methodObj.put("methodName", "架构KPI图");
|
if (model.getSchema().contains("架构KPI图")){
|
||||||
}
|
methodObj.put("methodName", "架构KPI图");
|
||||||
if (model.getSchema().contains("角色图")) {
|
}
|
||||||
methodObj.put("methodName", "角色图");
|
if (model.getSchema().contains("角色图")){
|
||||||
|
methodObj.put("methodName", "角色图");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// System.out.println(c+"对应的"+ PALMethodManager.getInstance().havingCreateMethodPerm(category, methodId, "process", model.getId()));
|
// System.out.println(c+"对应的"+ PALMethodManager.getInstance().havingCreateMethodPerm(category, methodId, "process", model.getId()));
|
||||||
|
|
||||||
//流程入口允许新建表单图和制度图 by金鹏
|
//流程入口允许新建表单图和制度图 by金鹏
|
||||||
if (category.equals("process") && model.getSchema().contains("表单图")) {
|
if (model.getId().equals("process.yilifreedommodel")) {
|
||||||
methodObj.put("havingCreatePerm", true);
|
if (StringUtils.isBlank(fileId)){
|
||||||
} else if (category.equals("process") && model.getSchema().contains("制度")) {
|
methodObj.put("havingCreatePerm", false);
|
||||||
|
}else {
|
||||||
|
String property = SDK.getAppAPI().getProperty(CoEConstant.APP_ID, "freedom.file");
|
||||||
|
if (StringUtils.isNotBlank(property)&&property.contains(fileId)){
|
||||||
|
methodObj.put("havingCreatePerm", true);
|
||||||
|
}else {
|
||||||
|
methodObj.put("havingCreatePerm", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if (category.equals("process") && model.getSchema().contains("表单图")) {
|
||||||
methodObj.put("havingCreatePerm", true);
|
methodObj.put("havingCreatePerm", true);
|
||||||
} else if (category.equals("process") && model.getSchema().contains("制度")) {
|
} else if (category.equals("process") && model.getSchema().contains("制度")) {
|
||||||
methodObj.put("havingCreatePerm", true);
|
methodObj.put("havingCreatePerm", true);
|
||||||
@ -11658,6 +11386,8 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
SDK.getLogAPI().consoleErr("复制文件[" + model.getName() + "][" + model.getId() + "]失败," + moveRo.getString("msg"));
|
SDK.getLogAPI().consoleErr("复制文件[" + model.getName() + "][" + model.getId() + "]失败," + moveRo.getString("msg"));
|
||||||
return ResponseObject.newErrResponse(moveRo.getString("msg")).toString();
|
return ResponseObject.newErrResponse(moveRo.getString("msg")).toString();
|
||||||
}
|
}
|
||||||
|
copyPalProcessLevelRoleCorrelationModelRepository(wsId, teamId, sourceId, result);
|
||||||
|
copyPalProcessLevelPerformanceCorrelationModelRepository(wsId, teamId, sourceId, result);
|
||||||
}
|
}
|
||||||
// 操作行为日志记录
|
// 操作行为日志记录
|
||||||
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
|
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
|
||||||
@ -11667,6 +11397,186 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
return ro.toString();
|
return ro.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步复制数据模型角色模型
|
||||||
|
*
|
||||||
|
* @param wsId
|
||||||
|
* @param teamId
|
||||||
|
* @param sourceIds
|
||||||
|
* @param targetId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String copyPalProcessLevelRoleCorrelationModelRepository(String wsId, String teamId, String sourceId, String resultmsg) {
|
||||||
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
|
|
||||||
|
CoeDesignerWeb coe = new CoeDesignerWeb(_uc);
|
||||||
|
Map<String, String> mapNewUUID = new HashMap<String, String>();
|
||||||
|
String useId = null;
|
||||||
|
String roleuseId = null;
|
||||||
|
//获取数据属性同步创建角色模型
|
||||||
|
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
|
||||||
|
PALRepositoryCache.getCache().get(sourceId);
|
||||||
|
|
||||||
|
List<DesignerShapeRelationModel> oldModelList = dao.getModelListByFileId(sourceId);
|
||||||
|
for (DesignerShapeRelationModel oldModel : oldModelList) {
|
||||||
|
|
||||||
|
//如果关联角色图,则同步复制角色图关联关系,由于角色图规定为本流程使用,所以获取一次
|
||||||
|
String methodIds = "";
|
||||||
|
if (oldModel.getAttrId().equals("role")) {
|
||||||
|
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||||
|
String targetId = checkAndCreatePalRoleFolderModel(coeProcessLevel, wsId);
|
||||||
|
PALRepositoryModel model = PALRepositoryCache.getCache().get(oldModel.getRelationFileId());
|
||||||
|
String result = copyFile(wsId, teamId, oldModel.getRelationFileId(), targetId, "all");
|
||||||
|
|
||||||
|
if (JSONObject.parseObject(resultmsg).get("result").equals("ok")) {
|
||||||
|
|
||||||
|
useId = JSONObject.parseObject(resultmsg).getJSONObject("data").getJSONObject("msg").getJSONObject("data").get("useId").toString();
|
||||||
|
|
||||||
|
if (UtilString.isNotEmpty(useId)) {
|
||||||
|
if (JSONObject.parseObject(result).get("result").equals("ok")) {
|
||||||
|
roleuseId = JSONObject.parseObject(result).getJSONObject("data").getJSONObject("msg").getJSONObject("data").get("useId").toString();
|
||||||
|
|
||||||
|
if (UtilString.isNotEmpty(roleuseId)) {
|
||||||
|
//插入关联模型数据
|
||||||
|
List dataList = new ArrayList();
|
||||||
|
dataList.add(0, "org.role");
|
||||||
|
dataList.add(1, useId);
|
||||||
|
int r = DBSql.update("update APP_ACT_COE_PAL_REPOSITORY set EXT2=? where ID=?", new Object[] { dataList.toString(), roleuseId });
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject moveRo = JSONObject.parseObject(result);
|
||||||
|
if (!"ok".equals(moveRo.getString("result"))) {
|
||||||
|
SDK.getLogAPI().consoleErr("复制文件[" + model.getName() + "][" + model.getId() + "]失败," + moveRo.getString("msg"));
|
||||||
|
return ResponseObject.newErrResponse(moveRo.getString("msg")).toString();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PALRepositoryModel> models = CoeProcessLevelUtil.queryPalRepositoryModelsByPalId(sourceId);
|
||||||
|
|
||||||
|
PALRepositoryModel model = PALRepositoryCache.getCache().get(sourceId);
|
||||||
|
// 获取新旧节点关联关系
|
||||||
|
mapNewUUID = (Map<String, String>) JSONObject.parseObject(resultmsg).getJSONObject("data").getJSONObject("msg").getJSONObject("data").get("mapNewUUID");
|
||||||
|
|
||||||
|
for (DesignerShapeRelationModel oldModel : oldModelList) {
|
||||||
|
//重新设置修订关联关系
|
||||||
|
DesignerShapeRelationModel newModel1 = new DesignerShapeRelationModel();
|
||||||
|
newModel1.setId(UUIDGener.getUUID());
|
||||||
|
newModel1.setFileId(useId);
|
||||||
|
newModel1.setShapeId(mapNewUUID.get(oldModel.getShapeId()));
|
||||||
|
newModel1.setShapeText(oldModel.getShapeText());
|
||||||
|
newModel1.setAttrId(oldModel.getAttrId());
|
||||||
|
newModel1.setRelationFileId(roleuseId);
|
||||||
|
newModel1.setRelationShapeId(oldModel.getRelationShapeId());
|
||||||
|
newModel1.setRelationShapeText(oldModel.getRelationShapeText());
|
||||||
|
dao.insert(newModel1);
|
||||||
|
}
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步复制文件属性绩效属性数据
|
||||||
|
*
|
||||||
|
* @param wsId
|
||||||
|
* @param teamId
|
||||||
|
* @param sourceIds
|
||||||
|
* @param targetId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String copyPalProcessLevelPerformanceCorrelationModelRepository(String wsId, String teamId, String sourceId, String resultmodel) {
|
||||||
|
|
||||||
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
|
String perforId = perforId = JSONObject.parseObject(resultmodel).getJSONObject("data").getJSONObject("msg").getJSONObject("data").get("useId").toString();
|
||||||
|
PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao();
|
||||||
|
List<PALRepositoryPropertyModel> oldPropertyList = repositoryPropertyDao.getPropertysByPlid(sourceId, "");
|
||||||
|
List<PALRepositoryPropertyModel> newPropertyList = new ArrayList<PALRepositoryPropertyModel>();
|
||||||
|
if (oldPropertyList != null && oldPropertyList.size() > 0) {
|
||||||
|
for (PALRepositoryPropertyModel propertyModel : oldPropertyList) {
|
||||||
|
|
||||||
|
//文件属性存在流程绩效,则同步创建关联关系
|
||||||
|
if (propertyModel.getPropertyId().equals("Process_performance_metrics")) {
|
||||||
|
String relationFileId = JSONObject.parseObject(propertyModel.getPropertyValue()).getString("relationFileId");
|
||||||
|
String[] splitRelationFileId;
|
||||||
|
PALRepositoryModel model;
|
||||||
|
|
||||||
|
if (UtilString.isNotEmpty(relationFileId)) {
|
||||||
|
if (relationFileId.contains(",")) {
|
||||||
|
splitRelationFileId = relationFileId.split(",");
|
||||||
|
relationFileId = splitRelationFileId[0];
|
||||||
|
} else {
|
||||||
|
relationFileId = relationFileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
model = PALRepositoryCache.getCache().get(relationFileId);
|
||||||
|
|
||||||
|
String result = copyFile(wsId, teamId, relationFileId, "control", "all");
|
||||||
|
|
||||||
|
JSONObject moveRo = JSONObject.parseObject(result);
|
||||||
|
if (!"ok".equals(moveRo.getString("result"))) {
|
||||||
|
SDK.getLogAPI().consoleErr("复制文件[" + model.getName() + "][" + model.getId() + "]失败," + moveRo.getString("msg"));
|
||||||
|
return ResponseObject.newErrResponse(moveRo.getString("msg")).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
CoeDesignerWeb coe = new CoeDesignerWeb(_uc);
|
||||||
|
// 处理流程属性
|
||||||
|
String property = CoePropertyUtil.getPropertyValue(relationFileId + "_attr");
|
||||||
|
if (!UtilString.isEmpty(property)) {
|
||||||
|
CoePropertyUtil.createProperty(moveRo.getString("result") + "_attr", property);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> mapNewUUID = (Map<String, String>) JSONObject.parseObject(result).getJSONObject("data").getJSONObject("msg").getJSONObject("data").get("mapNewUUID");
|
||||||
|
String newuuid = JSONObject.parseObject(result).getJSONObject("data").getJSONObject("msg").getJSONObject("data").get("useId").toString();
|
||||||
|
|
||||||
|
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
|
||||||
|
List<DesignerShapeRelationModel> oldModelList = dao.getModelListByFileId(sourceId);
|
||||||
|
|
||||||
|
oldModelList.sort(Comparator.comparing(DesignerShapeRelationModel::getShapeText));
|
||||||
|
|
||||||
|
for (DesignerShapeRelationModel oldModel : oldModelList) {
|
||||||
|
|
||||||
|
if (oldModel.getAttrId().equals("Process_performance_metrics")) {
|
||||||
|
//重新设置修订关联关系
|
||||||
|
DesignerShapeRelationModel newModel1 = new DesignerShapeRelationModel();
|
||||||
|
newModel1.setId(UUIDGener.getUUID());
|
||||||
|
newModel1.setFileId(perforId);
|
||||||
|
newModel1.setShapeId(mapNewUUID.get(oldModel.getShapeId()));
|
||||||
|
newModel1.setShapeText(oldModel.getShapeText());
|
||||||
|
newModel1.setAttrId(oldModel.getAttrId());
|
||||||
|
newModel1.setRelationFileId(newuuid);
|
||||||
|
newModel1.setRelationShapeId(oldModel.getRelationShapeId());
|
||||||
|
newModel1.setRelationShapeText(oldModel.getRelationShapeText());
|
||||||
|
dao.insert(newModel1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UtilString.isNotEmpty(newuuid)) {
|
||||||
|
//插入关联模型数据
|
||||||
|
List dataList = new ArrayList();
|
||||||
|
dataList.add(0, "control.kpi");
|
||||||
|
dataList.add(1, perforId);
|
||||||
|
int r = DBSql.update("update APP_ACT_COE_PAL_REPOSITORY set EXT2=? where ID=?", new Object[] { dataList.toString(), newuuid });
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验和创建角色模型文件夹
|
* 校验和创建角色模型文件夹
|
||||||
*
|
*
|
||||||
@ -11716,10 +11626,9 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
PALRepositoryCache.getAllChildrenModelsByPid(model.getWsId(), model.getId(), childList, ids);
|
PALRepositoryCache.getAllChildrenModelsByPid(model.getWsId(), model.getId(), childList, ids);
|
||||||
removeList.addAll(childList);
|
removeList.addAll(childList);
|
||||||
for (PALRepositoryModel removeModel : removeList) {
|
for (PALRepositoryModel removeModel : removeList) {
|
||||||
//校验禁止删除逻辑
|
//普通用户不允许删除已发布的文件
|
||||||
String errorResponse = checkRemovalPermission(removeModel, _uc);
|
if (removeModel.isPublish() && !"admin".equals(_uc.getUID())) {
|
||||||
if (errorResponse != null) {
|
return ResponseObject.newErrResponse("已发布文件["+ removeModel.getName() + VersionUtil.getVersionStrV(removeModel.getVersion()) + "]不允许删除,请联系系统管理员!").toString();
|
||||||
return errorResponse;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13218,18 +13127,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
return ro.toString();
|
return ro.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提取重复的错误判断逻辑到一个方法中
|
|
||||||
private String checkRemovalPermission(PALRepositoryModel model, UserContext _uc) {
|
|
||||||
if ("admin".equals(_uc.getUID())) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
//非设计状态(即草稿)不允许删除
|
|
||||||
if (model.isPublish() || model.isStop() || model.isApproval()) {
|
|
||||||
return ResponseObject.newErrResponse("文件[" + model.getName() + VersionUtil.getVersionStrV(model.getVersion()) + "]非草稿状态不允许删除,请联系系统管理员!").toString();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ComparatorMap implements Comparator<PALRepositoryModel> {
|
class ComparatorMap implements Comparator<PALRepositoryModel> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -13241,6 +13138,4 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,6 @@ public class StartListener implements AppListener {
|
|||||||
this.initMethod(appContext);
|
this.initMethod(appContext);
|
||||||
}
|
}
|
||||||
private void initMethod(AppContext appContext){
|
private void initMethod(AppContext appContext){
|
||||||
MethodAppManager.register("freedom.allmethod", appContext, "freedom.allmethod", "自由流程建模方法");
|
MethodAppManager.register("process.yilifreedommodel", appContext, "process.yilifreedommodel", "自由流程建模方法");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ public class Plugins implements PluginListener {
|
|||||||
params1.put("title", "自由模型建模方法");
|
params1.put("title", "自由模型建模方法");
|
||||||
params1.put("icon", "");
|
params1.put("icon", "");
|
||||||
params1.put("desc", "自由模型建模方法");
|
params1.put("desc", "自由模型建模方法");
|
||||||
params1.put("methodId", "freedom.allmethod");
|
params1.put("methodId", "process.yilifreedommodel");
|
||||||
params1.put("deletedClass", "");
|
params1.put("deletedClass", "");
|
||||||
list.add(new AppExtensionProfile("PAL流程资产库->自由模型建模方法", "aslp://com.actionsoft.apps.coe.pal/registerMethodApp", params1));
|
list.add(new AppExtensionProfile("PAL流程资产库->自由模型建模方法", "aslp://com.actionsoft.apps.coe.pal/registerMethodApp", params1));
|
||||||
return list;
|
return list;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user