Browse Source

处理全为空的问题

anderx 11 months ago
parent
commit
ce03bbfd16

+ 10 - 4
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -1435,6 +1435,8 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         List<SonExpenseAccount> sonList = res.getSonList();
         List<String> orderList = new ArrayList<>();
         List<SonExpenseAccount> orderSonList = new ArrayList<>();
+        //用来去重
+        List<String> strList = new ArrayList<>();
         sonList.stream().forEach(e -> {
             if (e.getOrderNo()==null){
                 orderSonList.add(e);
@@ -1512,10 +1514,14 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                 List<PublicReleaseDetails> list = publicReleaseMapper.selectDetailsByPrid(e.getPrid());
                 StringBuilder sb = new StringBuilder();
                 for (PublicReleaseDetails e2 : list) {
-                    User user = userMapper.queryById(e2.getUid());
-                    List<BigDecimal> orderNoNotCountAmount = expenseAccountMapper.getUidNotCountAmount(e2.getUid());
-                    BigDecimal countAmount = orderNoNotCountAmount.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
-                    sb.append("[").append(user.getNickname()).append("]未归集:").append(countAmount.stripTrailingZeros().toPlainString()).append("元,");
+                    //不重复就添加到strList并且计算归集
+                    if (!strList.contains(e2.getUid())){
+                        strList.add(e2.getUid());
+                        User user = userMapper.queryById(e2.getUid());
+                        List<BigDecimal> orderNoNotCountAmount = expenseAccountMapper.getUidNotCountAmount(e2.getUid());
+                        BigDecimal countAmount = orderNoNotCountAmount.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
+                        sb.append("[").append(user.getNickname()).append("]未归集:").append(countAmount.stripTrailingZeros().toPlainString()).append("元,");
+                    }
                 }
                 orderList.add(sb.substring(0,sb.length()-1));
             }