Quellcode durchsuchen

报销详情修改

anderx vor 1 Jahr
Ursprung
Commit
16b4f70fb7

+ 21 - 17
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -1422,27 +1422,31 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
 
             }
             if (e.getOrderNo()!=null){
-                TOrderPublicReleaseCount out = tOrderPublicReleaseCountMapper.selectByOrderNo(e.getOrderNo());
+
                 List<ExpenseAccount> expenseAccounts = expenseAccountMapper.selectByOrderNo(e.getOrderNo());
-                BigDecimal count = BigDecimal.ZERO;
-                BigDecimal yxyCount = BigDecimal.ZERO;
-                BigDecimal zxsCount = BigDecimal.ZERO;
-                BigDecimal qtCount = BigDecimal.ZERO;
-                for (ExpenseAccount ea : expenseAccounts) {
-                    count=count.add(ea.getAmount());
-                    Admin admin = adminMapper.selectByPrimaryKey(ea.getAid());
-                    if (admin.getPosition()!=null){
-                        if (admin.getPosition().equals("1")){
-                            yxyCount=yxyCount.add(ea.getAmount());
-                        }else if (admin.getPosition().equals("2")){
-                            zxsCount=zxsCount.add(ea.getAmount());
-                        }else {
-                            qtCount=qtCount.add(ea.getAmount());
+
+                if(!expenseAccounts.isEmpty()){
+                    TOrderPublicReleaseCount out = tOrderPublicReleaseCountMapper.selectByOrderNo(e.getOrderNo());
+                    BigDecimal count = BigDecimal.ZERO;
+                    BigDecimal yxyCount = BigDecimal.ZERO;
+                    BigDecimal zxsCount = BigDecimal.ZERO;
+                    BigDecimal qtCount = BigDecimal.ZERO;
+                    for (ExpenseAccount ea : expenseAccounts) {
+                        count=count.add(ea.getAmount());
+                        Admin admin = adminMapper.selectByPrimaryKey(ea.getAid());
+                        if (admin.getPosition()!=null){
+                            if (admin.getPosition().equals("1")){
+                                yxyCount=yxyCount.add(ea.getAmount());
+                            }else if (admin.getPosition().equals("2")){
+                                zxsCount=zxsCount.add(ea.getAmount());
+                            }else {
+                                qtCount=qtCount.add(ea.getAmount());
+                            }
                         }
                     }
+                    String str = getString(e, out, count, yxyCount, zxsCount,qtCount);
+                    e.setCountStr(str);
                 }
-                String str = getString(e, out, count, yxyCount, zxsCount,qtCount);
-                e.setCountStr(str);
             }
         }