|
@@ -90,13 +90,19 @@ public class FlwProcessServiceImpl extends ServiceImpl<FlwProcessMapper, FlwProc
|
|
|
|
|
|
boolean voIsNotEmpty = CollectionUtils.isNotEmpty(flwProcessVOList);
|
|
|
if (voIsNotEmpty) {
|
|
|
- // 过滤不存在角色权限的流程
|
|
|
- UserSession userSession = UserSession.getLoginInfo();
|
|
|
- List<Long> notExistProcessIds = flowlongMapper.selectNotExistProcessIds(userSession.getId());
|
|
|
- if (CollectionUtils.isNotEmpty(notExistProcessIds)) {
|
|
|
- flwProcessVOList = flwProcessVOList.stream().sorted(Comparator.comparing(FlwProcessVO::getProcessSort))
|
|
|
- .filter(t -> !notExistProcessIds.contains(t.getProcessId())).toList();
|
|
|
- } else {
|
|
|
+ boolean needSort = true;
|
|
|
+ if (launch) {
|
|
|
+ // 发起流程,过滤不存在角色权限的流程
|
|
|
+ UserSession userSession = UserSession.getLoginInfo();
|
|
|
+ List<Long> notExistProcessIds = flowlongMapper.selectNotExistProcessIds(userSession.getId());
|
|
|
+ if (CollectionUtils.isNotEmpty(notExistProcessIds)) {
|
|
|
+ needSort = false;
|
|
|
+ flwProcessVOList = flwProcessVOList.stream().sorted(Comparator.comparing(FlwProcessVO::getProcessSort))
|
|
|
+ .filter(t -> !notExistProcessIds.contains(t.getProcessId())).toList();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 排序
|
|
|
+ if (needSort) {
|
|
|
flwProcessVOList.sort(Comparator.comparing(FlwProcessVO::getProcessSort));
|
|
|
}
|
|
|
}
|
|
@@ -267,6 +273,13 @@ public class FlwProcessServiceImpl extends ServiceImpl<FlwProcessMapper, FlwProc
|
|
|
ApiAssert.fail(Objects.equals(3, checkConditionNode), "存在条件节点KEY重复");
|
|
|
}
|
|
|
ApiAssert.fail(!ModelHelper.checkExistApprovalNode(rootNode), "必须存在审批节点");
|
|
|
+
|
|
|
+ // 检查流程定义操作权限
|
|
|
+ if (null != dto.getProcessId()) {
|
|
|
+ this.checkOperateApproval(dto.getProcessId());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查流程定义KEY唯一性
|
|
|
this.checkProcessKey(dto.getProcessId(), dto.getProcessKey());
|
|
|
|
|
|
// 部署流程定义,修改会产生历史流程
|
|
@@ -327,6 +340,8 @@ public class FlwProcessServiceImpl extends ServiceImpl<FlwProcessMapper, FlwProc
|
|
|
public boolean removeProcessInfo(Long id) {
|
|
|
// 检查流程定义操作权限
|
|
|
this.checkOperateApproval(id);
|
|
|
+
|
|
|
+ // 删除流程
|
|
|
FlwProcess flwProcess = this.checkById(id);
|
|
|
if (Objects.equals(1, flwProcess.getProcessVersion())) {
|
|
|
this.cascadeRemoveById(flwProcess.getId());
|
|
@@ -397,6 +412,7 @@ public class FlwProcessServiceImpl extends ServiceImpl<FlwProcessMapper, FlwProc
|
|
|
public boolean updateSateById(Long id, Integer state) {
|
|
|
// 检查流程定义操作权限
|
|
|
this.checkOperateApproval(id);
|
|
|
+
|
|
|
// 更新流程定义排序
|
|
|
FlwProcess flwProcess = new FlwProcess();
|
|
|
flwProcess.setId(id);
|
|
@@ -413,6 +429,10 @@ public class FlwProcessServiceImpl extends ServiceImpl<FlwProcessMapper, FlwProc
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public boolean cloneById(Long id) {
|
|
|
+ // 检查流程定义操作权限
|
|
|
+ this.checkOperateApproval(id);
|
|
|
+
|
|
|
+ // 克隆流程
|
|
|
String suffix = "Copy" + System.currentTimeMillis();
|
|
|
FlwProcessDTO dto = this.getDtoById(id);
|
|
|
dto.setProcessId(null);
|
|
@@ -421,8 +441,8 @@ public class FlwProcessServiceImpl extends ServiceImpl<FlwProcessMapper, FlwProc
|
|
|
dto.setProcessType(dto.getProcessType());
|
|
|
String modelContent = dto.getModelContent();
|
|
|
Map<String, Object> modelContentMap = JacksonUtils.readMap(modelContent);
|
|
|
- modelContentMap.put("name",dto.getProcessName());
|
|
|
- modelContentMap.put("key",dto.getProcessKey());
|
|
|
+ modelContentMap.put("name", dto.getProcessName());
|
|
|
+ modelContentMap.put("key", dto.getProcessKey());
|
|
|
dto.setModelContent(JacksonUtils.toJson(modelContentMap));
|
|
|
return null != this.saveDto(dto);
|
|
|
}
|
|
@@ -430,6 +450,10 @@ public class FlwProcessServiceImpl extends ServiceImpl<FlwProcessMapper, FlwProc
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public boolean checkoutById(Long id) {
|
|
|
+ // 检查流程定义操作权限
|
|
|
+ this.checkOperateApproval(id);
|
|
|
+
|
|
|
+ // 检出历史流程
|
|
|
FlwProcess flwProcess = this.checkById(id);
|
|
|
final int hisVersion = flwProcess.getProcessVersion();
|
|
|
FlwProcess currentProcess = lambdaQuery().eq(FlwProcess::getProcessKey, flwProcess.getProcessKey())
|