Prechádzať zdrojové kódy

优化质检任务流程排序

lvy 1 týždeň pred
rodič
commit
555be6d83e

+ 6 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/FixedFlowController.java

@@ -195,7 +195,7 @@ public class FixedFlowController extends BladeController {
         IPage<FixedFlowVO> page = this.fixedFlowService.selectFixedFlowPage(vo);
         List<FixedFlowVO> records = page.getRecords();
         if (records != null && !records.isEmpty()) {
-            Map<Boolean, List<FixedFlowVO>> groupMap = records.stream().collect(Collectors.groupingBy(record -> record.getFixedFlowName() != null && record.getFixedFlowName().contains("_")));
+            Map<Boolean, List<FixedFlowVO>> groupMap = records.stream().collect(Collectors.groupingBy(record -> record.getFixedFlowName() != null && record.getFixedFlowName().contains("_") && record.getSort() == null));
             List<FixedFlowVO> copyFixedFlowVOS = groupMap.get(true);
             List<FixedFlowVO> fixedFlowVOS = groupMap.get(false);
             if (copyFixedFlowVOS ==  null || copyFixedFlowVOS.isEmpty() || fixedFlowVOS ==  null || fixedFlowVOS.isEmpty()) {
@@ -444,6 +444,7 @@ public class FixedFlowController extends BladeController {
                     if(i>0){
                         userSort += Func.toLongList(dto.getFixedBranchList().get(i-1).getUserIds()).size();
                     }
+                    List<FixedFlowLink> saveList = new ArrayList<>();
                     for (String userId : fixedBranch.getUserIds().split(",")) {
                         User user = userMap.get(Long.parseLong(userId));
                         if (user == null) {
@@ -460,6 +461,10 @@ public class FixedFlowController extends BladeController {
                         fixedFlowLink.setContractId(dto.getContractId());
                         fixedFlowLink.setFixedFlowBranchSort(userSort+=1);
                         fixedFlowLink.setFlowTaskType(fixedBranch.getFlowTaskType());
+                        saveList.add(fixedFlowLink);
+                    }
+                    if (!saveList.isEmpty()) {
+                        fixedFlowLinkService.saveBatch(saveList);
                     }
                 }
                 return R.success("操作成功");