2
0
Просмотр исходного кода

查询当前收入归集设置关联的会计科目1.0

ljx 4 лет назад
Родитель
Сommit
7a9929dd9e

+ 6 - 11
src/main/java/com/imed/costaccount/service/impl/CostIncomeGroupSetServiceImpl.java

@@ -262,21 +262,16 @@ public class CostIncomeGroupSetServiceImpl extends ServiceImpl<CostIncomeGroupSe
         if (Objects.isNull(incomeGroupSet)){
             throw new CostException(500,"收入归集设置不存在");
         }
-        List<Accounting> accountingList = accountingService.list(new QueryWrapper<Accounting>().lambda()
-                .eq(Accounting::getHospId, hospId));
-        List<AccountIncomeSetVO> accountIncomeSetVOS = new ArrayList<>();
-        List<AccountIncomeSetVO> accountIncomeSetVOList = BeanUtil.convertList(accountingList, AccountIncomeSetVO.class);
         String accountCode = incomeGroupSet.getAccountCode();
+        List<AccountIncomeSetVO> accountIncomeSetVOList = null;
         if (StrUtil.isNotBlank(accountCode)){
             List<String> accountCodList = Arrays.asList(accountCode.split(StrUtil.COMMA));
-            Map<String, List<String>> map = accountCodList.stream().collect(Collectors.groupingBy(String::valueOf));
-            accountIncomeSetVOList.forEach(i->{
-                if (!CollectionUtils.isEmpty(map.get(i.getAccountingCode()))){
-                    accountIncomeSetVOS.add(i);
-                }
-            });
+            List<Accounting> accountingList = accountingService.list(new QueryWrapper<Accounting>().lambda()
+                    .eq(Accounting::getHospId, hospId)
+                    .in(Accounting::getAccountingCode,accountCodList));
+            accountIncomeSetVOList = BeanUtil.convertList(accountingList, AccountIncomeSetVO.class);
         }
-        return accountIncomeSetVOS;
+        return accountIncomeSetVOList;
     }
 
 }