Browse Source

1.其他收入单,其他支出单bug修改

heqinwei 7 years ago
parent
commit
a9309a32c1

+ 36 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/OthreceiptsServiceImpl.java

@@ -209,6 +209,7 @@ public class OthreceiptsServiceImpl extends CommonBaseServiceImpl<OthreceiptsMap
         //删除中间表
         othreceipts = othreceiptsMapper.selectByPrimaryKey(id);
         banksubledgerMapper.deleteByPrimaryKey(othreceipts.getOr_code(), "其他收入单");
+        subledgerMapper.deleteByPrimaryKey(othreceipts.getOr_code(), "其他收入单");
 
         //更新资金
         Double amount = banksubledgerMapper.selectThisamount(othreceipts.getOr_bankcode());
@@ -220,6 +221,41 @@ public class OthreceiptsServiceImpl extends CommonBaseServiceImpl<OthreceiptsMap
                     othreceipts.getOr_bankcode(), "-");
         }
 
+        //资金账号表
+        int bk_inid = othreceipts.getOr_bankid();
+
+        Double or_amount = othreceipts.getOr_amount();
+        //收款
+        Bankinformation bankinformation = bankinformationMapper.selectByPrimaryKey(bk_inid);
+        Double beginamount = bankinformation.getBk_beginamount();
+        Double spending = bankinformation.getBk_spending() == null ? new Double(0) : bankinformation.getBk_spending();
+        Double incomme = bankinformation.getBk_income() == null ? new Double(0) : bankinformation.getBk_income();
+        bankinformation.setBk_thisamount(beginamount + incomme - spending - or_amount);
+        bankinformation.setBk_income(incomme - or_amount);
+        bankinformation.setBk_spending(spending);
+        bankinformationMapper.updateByPrimaryKeySelective(bankinformation);
+
+        //客户付款
+        /**
+         * 更新客户资料
+         * cu_preamount=nvl(cu_preamount,0)+rb_preamount,
+         * cu_recamount=nvl(cu_recamount,0)-rb_rbdamount,
+         * cu_leftamount=cu_beginaramount-cu_beginprerecamount+cu_recamount-cu_preamount;
+         */
+        Customer customerData = recbalanceMapper.selectCustomerByPrimaryKey(othreceipts.getOr_custid());
+        Double preamount = customerData.getCu_preamount()==null?new Double(0):customerData.getCu_preamount();
+        Double beginapamount = customerData.getCu_beginaramount()==null?new Double(0):customerData.getCu_beginaramount();
+        Double beginprepayamount= customerData.getCu_beginprerecamount()==null?new Double(0):customerData.getCu_beginprerecamount();
+        Double recamount = customerData.getCu_recamount()==null?new Double(0):customerData.getCu_recamount();
+
+        Customer customer = new Customer();
+        customer.setId(Long.valueOf(othreceipts.getOr_custid()));
+        customer.setCu_preamount(preamount);
+        customer.setCu_recamount(recamount-or_amount);
+        customer.setCu_leftamount(beginapamount+beginprepayamount-recamount+or_amount+preamount);
+        recbalanceMapper.updateCustomerByPrimaryKeySelective(customer);
+
+
         //计算期间金额
         Statsinfo statsinfo = new Statsinfo();
         List<Integer> ymList = othreceiptsdetailMapper.selectYm(id);

+ 1 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/OthspendingsServiceImpl.java

@@ -240,7 +240,7 @@ public class OthspendingsServiceImpl extends CommonBaseServiceImpl<OthspendingsM
 
         //删除中间表
         othspendings = othspendingsMapper.selectByPrimaryKey(id);
-        banksubledgerMapper.deleteByPrimaryKey(othspendings.getOs_code(), "其他收入单");
+        banksubledgerMapper.deleteByPrimaryKey(othspendings.getOs_code(), "其他支出单");
         subledgerMapper.deleteByPrimaryKey(othspendings.getOs_code(), "其他支出单");
 
         //资金