Selaa lähdekoodia

Merge branch 'master' of huangrui/CostAccount into dev

huangrui 4 vuotta sitten
vanhempi
commit
a1315ca34e

+ 3 - 6
src/main/java/com/imed/costaccount/service/impl/AllocationServiceImpl.java

@@ -116,9 +116,6 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
             for (Responsibility responsibility : responsibilities) {
                 String responsibilityCode = responsibility.getResponsibilityCode();
                 // 得到分摊参数对应记录,不存在,下一个
-                if (responsibilityCode.equals("123")) {
-                    System.out.println(1);
-                }
                 List<CostAccountShare> accountShares = accountShareService.getByResponsibility(responsibilityCode, hospId);
                 if (accountShares.isEmpty()) {
                     continue;
@@ -311,19 +308,19 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
         if (CollUtil.isEmpty(costingGroups)) {
             return BigDecimal.ZERO;
         }
-        // 计算方式 0是合并计算  1是分开计算
         BigDecimal costAmount = BigDecimal.ZERO;
         List<Allocation> all = new ArrayList<>();
         if (!costList.isEmpty()) {
             all = costList.stream().filter(i -> i.getTargetResponsibilityCode().equals(responsibilityCode)).collect(Collectors.toList());
         }
+        // 计算方式 0是合并计算  1是分开计算
         if (calcType == 0) {
             costAmount = costingGroups.stream().map(CostCostingGroup::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
             if (!all.isEmpty()) {
 
                 BigDecimal bigDecimal = all.stream()
                         .map(Allocation::getAmount)
-                        .reduce(BigDecimal.ZERO, BigDecimal::add);
+                        .reduce(BigDecimal.ZERO, BigDecimal::subtract);
 
                 if (Objects.nonNull(bigDecimal)) {
                     costAmount = costAmount.add(bigDecimal);
@@ -342,7 +339,7 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
                 if (!all.isEmpty()) {
                     BigDecimal bigDecimal = all.stream()
                             .map(Allocation::getAmount)
-                            .reduce(BigDecimal.ZERO, BigDecimal::add);
+                            .reduce(BigDecimal.ZERO, BigDecimal::subtract);
                     if (Objects.nonNull(bigDecimal)) {
                         costAmount = costAmount.add(bigDecimal);
                     }