Browse Source

1.客户,供应商对账单

heqinwei 7 years ago
parent
commit
d07d1297b3

+ 44 - 41
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/MoneyReportServiceImpl.java

@@ -98,7 +98,6 @@ public class MoneyReportServiceImpl implements MoneyReportService {
         }
 
         String res = null;
-        VendOrCustAdd vendOrCustAdd = new VendOrCustAdd();
         List<Map<String, Double>> list1 = new ArrayList<>();
         if ("Supplier".equals(type)) {
             list = vendorAcountViewMapper.selectByCondition(con, companyId);
@@ -107,26 +106,28 @@ public class MoneyReportServiceImpl implements MoneyReportService {
                 Integer vid = new Integer(0);
                 vid = vendorAcountViewMapper.getId(vendorAcountView.getPi_vendcode(), Long.valueOf(vendorAcountView.getCompanyId()));
                 Integer ym = Integer.valueOf(req.getYm());
-                vendOrCustAdd = vendorAcountViewMapper.selectVendAdd(vid, ym, Long.valueOf(vendorAcountView.getCompanyId()));
-                vendOrCustAdd.setNowbalance((vendOrCustAdd.getBeginamount() == null ? new Double(0) : vendOrCustAdd.getBeginamount())
-                        + (vendOrCustAdd.getNowamount() == null ? new Double(0) : vendOrCustAdd.getNowamount())
-                        - (vendOrCustAdd.getNowpay() == null ? new Double(0) : vendOrCustAdd.getNowpay()));
-                //封装成list
-                Map<String, Double> map1 = new HashMap<>();
-                map1.put("beginamount", vendOrCustAdd.getBeginamount());
-                list1.add(map1);
-
-                Map<String, Double> map2 = new HashMap<>();
-                map2.put("nowamount", vendOrCustAdd.getNowamount());
-                list1.add(map2);
-
-                Map<String, Double> map3 = new HashMap<>();
-                map3.put("nowpay", vendOrCustAdd.getNowpay());
-                list1.add(map3);
-
-                Map<String, Double> map4 = new HashMap<>();
-                map4.put("nowbalance", vendOrCustAdd.getNowbalance());
-                list1.add(map4);
+                VendOrCustAdd vendOrCustAdd = vendorAcountViewMapper.selectVendAdd(vid, ym, Long.valueOf(vendorAcountView.getCompanyId()));
+                if (vendOrCustAdd != null) {
+                    vendOrCustAdd.setNowbalance((vendOrCustAdd.getBeginamount() == null ? new Double(0) : vendOrCustAdd.getBeginamount())
+                            + (vendOrCustAdd.getNowamount() == null ? new Double(0) : vendOrCustAdd.getNowamount())
+                            - (vendOrCustAdd.getNowpay() == null ? new Double(0) : vendOrCustAdd.getNowpay()));
+                    //封装成list
+                    Map<String, Double> map1 = new HashMap<>();
+                    map1.put("beginamount", vendOrCustAdd.getBeginamount());
+                    list1.add(map1);
+
+                    Map<String, Double> map2 = new HashMap<>();
+                    map2.put("nowamount", vendOrCustAdd.getNowamount());
+                    list1.add(map2);
+
+                    Map<String, Double> map3 = new HashMap<>();
+                    map3.put("nowpay", vendOrCustAdd.getNowpay());
+                    list1.add(map3);
+
+                    Map<String, Double> map4 = new HashMap<>();
+                    map4.put("nowbalance", vendOrCustAdd.getNowbalance());
+                    list1.add(map4);
+                }
             }
         } else if("payDetail".equals(type)){
             list = paydetailViewMapper.selectByCondition(con, companyId);
@@ -154,26 +155,28 @@ public class MoneyReportServiceImpl implements MoneyReportService {
 
                 vid = customerCheckViewMapper.getId(customerCheckView.getPi_custcode(), Long.valueOf(customerCheckView.getCompanyId()));
                 Integer ym = Integer.valueOf(req.getYm());
-                vendOrCustAdd = customerCheckViewMapper.selectCustAdd(vid, ym, Long.valueOf(customerCheckView.getCompanyId()));
-                vendOrCustAdd.setNowbalance((vendOrCustAdd.getBeginamount() == null ? new Double(0) : vendOrCustAdd.getBeginamount())
-                        + (vendOrCustAdd.getNowamount() == null ? new Double(0) : vendOrCustAdd.getNowamount())
-                        - (vendOrCustAdd.getNowpay() == null ? new Double(0) : vendOrCustAdd.getNowpay()));
-                //封装成list
-                Map<String, Double> map1 = new HashMap<>();
-                map1.put("beginamount", vendOrCustAdd.getBeginamount());
-                list1.add(map1);
-
-                Map<String, Double> map2 = new HashMap<>();
-                map2.put("nowamount", vendOrCustAdd.getNowamount());
-                list1.add(map2);
-
-                Map<String, Double> map3 = new HashMap<>();
-                map3.put("nowpay", vendOrCustAdd.getNowpay());
-                list1.add(map3);
-
-                Map<String, Double> map4 = new HashMap<>();
-                map4.put("nowbalance", vendOrCustAdd.getNowbalance());
-                list1.add(map4);
+                VendOrCustAdd vendOrCustAdd = customerCheckViewMapper.selectCustAdd(vid, ym, Long.valueOf(customerCheckView.getCompanyId()));
+                if (vendOrCustAdd != null) {
+                    vendOrCustAdd.setNowbalance((vendOrCustAdd.getBeginamount() == null ? new Double(0) : vendOrCustAdd.getBeginamount())
+                            + (vendOrCustAdd.getNowamount() == null ? new Double(0) : vendOrCustAdd.getNowamount())
+                            - (vendOrCustAdd.getNowpay() == null ? new Double(0) : vendOrCustAdd.getNowpay()));
+                    //封装成list
+                    Map<String, Double> map1 = new HashMap<>();
+                    map1.put("beginamount", vendOrCustAdd.getBeginamount());
+                    list1.add(map1);
+
+                    Map<String, Double> map2 = new HashMap<>();
+                    map2.put("nowamount", vendOrCustAdd.getNowamount());
+                    list1.add(map2);
+
+                    Map<String, Double> map3 = new HashMap<>();
+                    map3.put("nowpay", vendOrCustAdd.getNowpay());
+                    list1.add(map3);
+
+                    Map<String, Double> map4 = new HashMap<>();
+                    map4.put("nowbalance", vendOrCustAdd.getNowbalance());
+                    list1.add(map4);
+                }
             }
         }else if ("accountdetails".equals(type)){
             list = accountDetailsViewMapper.selectByCondition(con, companyId);