lvy 5 өдөр өмнө
parent
commit
e38005bbf7

+ 14 - 8
blade-service/blade-business/src/main/java/org/springblade/business/controller/FixedFlowController.java

@@ -458,6 +458,7 @@ public class FixedFlowController extends BladeController {
             fixedFlow.setContractId(dto.getContractId());
             fixedFlow.setStatus(1);
             fixedFlow.setIsMeter(0);
+            fixedFlow.setSort(0);
             fixedFlow.setCreateTime(new Date());
             boolean save = fixedFlowService.save(fixedFlow);
             if (save) {
@@ -468,6 +469,9 @@ public class FixedFlowController extends BladeController {
                         userSort += Func.toLongList(dto.getFixedBranchList().get(i-1).getUserIds()).size();
                     }
                     List<FixedFlowLink> saveList = new ArrayList<>();
+                    if (fixedBranch.getUserIds() ==  null) {
+                        continue;
+                    }
                     for (String userId : fixedBranch.getUserIds().split(",")) {
                         User user = userMap.get(Long.parseLong(userId));
                         if (user == null) {
@@ -511,7 +515,7 @@ public class FixedFlowController extends BladeController {
         IPage<FixedFlow> fixedFlowsPage = fixedFlowService.getBaseMapper().selectPage(page,
                 Wrappers.<FixedFlow>lambdaQuery()
                         .eq(FixedFlow::getContractId, dto.getContractId())
-                        .eq(FixedFlow::getProjectId, dto.getProjectId()).last(" and (is_meter is null or is_meter != 1)"));
+                        .eq(FixedFlow::getProjectId, dto.getProjectId()).last(" and (is_meter is null or is_meter != 1) order by sort"));
         List<FixedFlow> fixedFlows = fixedFlowsPage.getRecords();
         List<Long> collect = fixedFlows.stream().map(FixedFlow::getId).collect(Collectors.toList());
         if (!collect.isEmpty()) {
@@ -565,7 +569,6 @@ public class FixedFlowController extends BladeController {
             resultMap.setSize(fixedFlowsPage.getSize());
             resultMap.setTotal(fixedFlowsPage.getTotal());
             resultMap.setRecords(fixedFlowVOList);
-            fixedFlowVOList.sort(Comparator.comparing(item -> item.getSort() == null ? 0 : item.getSort()));
             Map<Boolean, List<FixedFlowVO>> groupMap = fixedFlowVOList.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);
@@ -573,9 +576,9 @@ public class FixedFlowController extends BladeController {
                 return R.data(resultMap);
             }
             Map<String, List<FixedFlowVO>> nameMap = copyFixedFlowVOS.stream().collect(Collectors.groupingBy(record -> record.getFixedFlowName().split("_")[0]));
-            List<FixedFlowVO> newData = new ArrayList<>();
+            List<FixedFlowVO> newData = new ArrayList<>(fixedFlowVOList);
             for (FixedFlowVO flowVO : fixedFlowVOS) {
-                newData.add(flowVO);
+//                newData.add(flowVO);
                 List<FixedFlowVO> flowVOS = nameMap.get(flowVO.getFixedFlowName());
                 if (flowVOS != null && !flowVOS.isEmpty()) {
                     flowVOS.sort(Comparator.comparing(FixedFlow::getFixedFlowName));
@@ -685,10 +688,10 @@ public class FixedFlowController extends BladeController {
                 String ids = users.stream().map(user -> user.getId() + "").collect(Collectors.joining(","));
                 List<SignPfxFile> signPfxFiles = jdbcTemplate.query("select * from m_sign_pfx_file where is_register = 1 and certificate_user_id in ( " + ids + " )", new BeanPropertyRowMapper<>(SignPfxFile.class));
                 Map<String, List<SignPfxFile>> collect = signPfxFiles.stream().collect(Collectors.groupingBy(signPfxFile -> signPfxFile.getCertificateUserId() + ""));
-                for (String userId : userIds) {
-                    List<SignPfxFile> userPfxList = collect.get(userId);
+                for (User user : users) {
+                    List<SignPfxFile> userPfxList = collect.get(user.getId() + "");
                     if (userPfxList == null || userPfxList.isEmpty()) {
-                        notCertificateUserInfoSet.add(userId);
+                        notCertificateUserInfoSet.add(user.getId() + "");
                     }
                 }
                 if (!notCertificateUserInfoSet.isEmpty()) {
@@ -720,8 +723,11 @@ public class FixedFlowController extends BladeController {
                 if (i > 0) {
                     userSort += Func.toLongList(dto.getFixedBranchList().get(i - 1).getUserIds()).size();
                 }
+                if (fixedBranch.getUserIds() ==  null) {
+                    continue;
+                }
                 List<FixedFlowLink> saveList = new ArrayList<>();
-                for (String userId : userIds) {
+                for (String userId : fixedBranch.getUserIds().split(",")) {
                     FixedFlowLink fixedFlowLink = new FixedFlowLink();
                     fixedFlowLink.setFixedFlowId(dto.getFixedFlowId());
                     fixedFlowLink.setFixedFlowLink(fixedBranch.getName());

+ 3 - 0
blade-service/blade-system/src/main/java/org/springblade/system/mapper/DictBizMapper.xml

@@ -40,6 +40,9 @@
         <if test="notRoot != null and notRoot != ''">
             and parent_id > 0
         </if>
+        <if test="tenantId != null and tenantId != ''">
+            and tenant_id = #{tenantId}
+        </if>
         and is_sealed = 0 and is_deleted = 0
         order by sort
     </select>