Selaa lähdekoodia

任务流程复制返回新流程id

lvy 2 päivää sitten
vanhempi
commit
33f6c24415

+ 7 - 2
blade-service/blade-business/src/main/java/org/springblade/business/controller/FixedFlowController.java

@@ -337,7 +337,7 @@ public class FixedFlowController extends BladeController {
     @ApiOperationSupport(order = 6)
     @ApiOperation(value = "复制", notes = "传入fixedFlow id")
     @Transactional(rollbackFor = Exception.class)
-    public R<Boolean> copy(String ids) {
+    public R<String> copy(String ids) {
         if (StringUtils.isBlank(ids)) {
             return R.fail("请选择要复制的流程");
         }
@@ -350,9 +350,11 @@ public class FixedFlowController extends BladeController {
         Map<Long, List<FixedFlowLink>> linkMap = fixedFlowLinkList.stream().collect(Collectors.groupingBy(FixedFlowLink::getFixedFlowId));
         List<FixedFlowLink> newFixedFolwLinkList = new ArrayList<>();
         Map<String, Long> nameCountMap = new HashMap<>();
+        StringBuilder sb = new StringBuilder();
         fixedFlowList.forEach(fixedFlow -> {
             //生成主表主键
             long fixedFlowId = SnowFlakeUtil.getId();
+            sb.append(fixedFlowId).append( ",");
             List<FixedFlowLink> sourceFixedFolwLinkList = linkMap.get(fixedFlow.getId());
             if (sourceFixedFolwLinkList != null && !sourceFixedFolwLinkList.isEmpty()) {
                 for (FixedFlowLink fixedFlowLink : sourceFixedFolwLinkList) {
@@ -388,7 +390,10 @@ public class FixedFlowController extends BladeController {
         if (flow && !newFixedFolwLinkList.isEmpty()) {
             flow = this.fixedFlowLinkService.saveBatch(newFixedFolwLinkList);
         }
-        return R.data(flow);
+        if (flow) {
+            return R.data(sb.deleteCharAt(sb.length() - 1).toString());
+        }
+        return R.status(false);
     }
 
     @PostMapping("/saveFixedFlow")