优化流程删除时对于角色图、绩效图的同步删除,使其在回收站中归属于同一条removeId;完善在删除模型以及删除模型版本2个场景的删除逻辑
This commit is contained in:
parent
e8ba2ceb00
commit
ee0e60f001
Binary file not shown.
@ -66,6 +66,10 @@ public class PALRepositoryCache extends Cache<String, PALRepositoryModel> {
|
||||
return getCache().getByIndex(PALRepositoryCacheIndex1.class, wsId);
|
||||
}
|
||||
|
||||
public static List<PALRepositoryModel> getListByWsId(String wsId) {
|
||||
return iteratorToList(getByWsId(wsId));
|
||||
}
|
||||
|
||||
// 获取当前流程id的第一级子节点流程
|
||||
public static Iterator<PALRepositoryModel> getByPid(String wsId, String pid) {
|
||||
return getCache().getByIndex(PALRepositoryCacheIndex2.class, wsId + "_" + pid);
|
||||
|
||||
@ -5084,14 +5084,40 @@ public class CoeDesignerWeb extends ActionWeb {
|
||||
*/
|
||||
public String deletePalDesignerVersion(String wsId, String teamId, String id) {
|
||||
ResponseObject ro;
|
||||
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(id);
|
||||
PALRepository dao = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||
PALRepositoryModel plModel = dao.getInstance(id);
|
||||
List<PALRepositoryModel> list = new ArrayList<PALRepositoryModel>();
|
||||
list.add(plModel);
|
||||
// 同时将相关的角色图、绩效图也放入回收站
|
||||
if ("process.bpmn2,process.epc,process.flowchart".contains(plModel.getMethodId())) {
|
||||
List data1 = new ArrayList();
|
||||
data1.add(0, "org.role");
|
||||
data1.add(1, plModel.getId().trim());
|
||||
List data2 = new ArrayList();
|
||||
data2.add(0, "control.kpi");
|
||||
data2.add(1, plModel.getId().trim());
|
||||
List<String> confidentialList = new ArrayList();
|
||||
confidentialList.add(data1.toString());
|
||||
List<PALRepositoryModel> tmpList1 = dao.searchRepositoryByMethodIdAndExt2("org.role", confidentialList);
|
||||
if (CollectionUtils.isNotEmpty(tmpList1)) {
|
||||
list.addAll(tmpList1);
|
||||
}
|
||||
confidentialList.set(0, data2.toString());
|
||||
List<PALRepositoryModel> tmpList2 = dao.searchRepositoryByMethodIdAndExt2("control.kpi", confidentialList);
|
||||
if (CollectionUtils.isNotEmpty(tmpList2)) {
|
||||
list.addAll(tmpList2);
|
||||
}
|
||||
}
|
||||
|
||||
CoeProcessRecycleWeb recycleWeb = new CoeProcessRecycleWeb(_uc);
|
||||
boolean insertFlag = recycleWeb.saveRecycleProcesses(plModel, list); // 流程信息存入回收站
|
||||
|
||||
if (insertFlag) {
|
||||
CoeProcessLevelDaoFacotory.createCoeProcessLevel().deletePalRepositoryVersion(id);
|
||||
List<String> idList = new ArrayList<>();
|
||||
for (PALRepositoryModel model : list) {
|
||||
idList.add(model.getId());
|
||||
}
|
||||
CoeProcessLevelDaoFacotory.createCoeProcessLevel().removeProcessLevel(StringUtils.join(idList, ","));// 删除流程
|
||||
CoeProcessLevelNoCache.getInstance().reloadInBackground(plModel.getWsId()); // 重新装载编号
|
||||
ro = ResponseObject.newOkResponse();
|
||||
ro.msg("已放入回收站");
|
||||
@ -5099,7 +5125,6 @@ public class CoeDesignerWeb extends ActionWeb {
|
||||
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
|
||||
CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_REPOSITORY, CoEOpLogConst.OP_DELETE, CoEOpLogConst.INFO_REPOSITORY_VERSION_DELETE);
|
||||
}
|
||||
deletePalCorrelationModel(wsId, teamId, id);
|
||||
} else {
|
||||
ro = ResponseObject.newErrResponse();
|
||||
ro.msg("删除失败");
|
||||
@ -5107,48 +5132,6 @@ public class CoeDesignerWeb extends ActionWeb {
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步删除关联绩效角色数据模型
|
||||
*
|
||||
* @param wsId
|
||||
* @param teamId
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public String deletePalCorrelationModel(String wsId, String teamId, String id) {
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
|
||||
List<DesignerShapeRelationModel> oldModelList = dao.getModelListByFileId(id);
|
||||
|
||||
if (oldModelList.size() > 0) {
|
||||
DesignerShapeRelationModel oldModel = oldModelList.get(0);
|
||||
//如果关联角色图,则同步复制角色图关联关系
|
||||
String methodIds = "";
|
||||
if (oldModel.getAttrId().equals("role")) {
|
||||
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(oldModel.getRelationFileId());
|
||||
List<PALRepositoryModel> list = new ArrayList<PALRepositoryModel>();
|
||||
list.add(plModel);
|
||||
CoeProcessRecycleWeb recycleWeb = new CoeProcessRecycleWeb(_uc);
|
||||
boolean insertFlag = recycleWeb.saveRecycleProcesses(plModel, list); // 流程信息存入回收站
|
||||
|
||||
if (insertFlag) {
|
||||
CoeProcessLevelDaoFacotory.createCoeProcessLevel().deletePalRepositoryVersion(oldModel.getRelationFileId());
|
||||
CoeProcessLevelNoCache.getInstance().reloadInBackground(plModel.getWsId()); // 重新装载编号
|
||||
ro.msg("已放入回收站");
|
||||
// 操作行为日志记录
|
||||
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
|
||||
CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_REPOSITORY, CoEOpLogConst.OP_DELETE, CoEOpLogConst.INFO_REPOSITORY_VERSION_DELETE);
|
||||
}
|
||||
} else {
|
||||
ro = ResponseObject.newErrResponse();
|
||||
ro.msg("删除失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设计器-切换版本状态为使用中
|
||||
*
|
||||
|
||||
@ -3798,6 +3798,31 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
String parentVersionId = model.getParentId();
|
||||
List<PALRepositoryModel> list = dao.getAllRepositoryByVersionId(model.getVersionId()); // versionId相同的流程
|
||||
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()));
|
||||
} else if (mapByExt2.containsKey(data2.toString())) {
|
||||
tmpList.addAll(mapByExt2.get(data2.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
list.addAll(tmpList);
|
||||
|
||||
Map<String, String> palMap = new HashMap<String, String>();
|
||||
List<PALRepositoryModel> removeList = new ArrayList<PALRepositoryModel>();
|
||||
for (PALRepositoryModel obj : list) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user