Procházet zdrojové kódy

1.账单转存审核报错问题
2.取单号加锁

heqinwei před 7 roky
rodič
revize
1105b98c1f

+ 11 - 7
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/FundtransferServiceImpl.java

@@ -145,7 +145,7 @@ public class FundtransferServiceImpl extends CommonBaseServiceImpl<FundtransferM
             Double bk_amount = fundtransferdetail.getFtd_nowbalance();
             //付款方
             Bankinformation bankinformation = bankinformationMapper.selectByPrimaryKey(bk_id);
-            Double beginamount = bankinformation.getBk_beginamount();
+            Double beginamount = bankinformation.getBk_beginamount() == null ? new Double(0) : 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 - bk_amount);
@@ -154,7 +154,7 @@ public class FundtransferServiceImpl extends CommonBaseServiceImpl<FundtransferM
 
             //收款方
             Bankinformation inbankinformation = bankinformationMapper.selectByPrimaryKey(bk_inid);
-            Double inbeginamount = inbankinformation.getBk_beginamount();
+            Double inbeginamount = inbankinformation.getBk_beginamount()== null ? new Double(0) : inbankinformation.getBk_beginamount();
             Double inspending = inbankinformation.getBk_spending() == null ? new Double(0) : inbankinformation.getBk_spending();
             Double inincomme = inbankinformation.getBk_income() == null ? new Double(0) : inbankinformation.getBk_income();
             inbankinformation.setBk_thisamount(inbeginamount + inincomme - inspending + bk_amount);
@@ -202,7 +202,7 @@ public class FundtransferServiceImpl extends CommonBaseServiceImpl<FundtransferM
             Double bk_amount = fundtransferdetail.getFtd_nowbalance();
             //付款方
             Bankinformation bankinformation = bankinformationMapper.selectByPrimaryKey(bk_id);
-            Double beginamount = bankinformation.getBk_beginamount();
+            Double beginamount = bankinformation.getBk_beginamount()== null ? new Double(0) : 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 + bk_amount);
@@ -211,7 +211,7 @@ public class FundtransferServiceImpl extends CommonBaseServiceImpl<FundtransferM
 
             //收款方
             Bankinformation inbankinformation = bankinformationMapper.selectByPrimaryKey(bk_inid);
-            Double inbeginamount = inbankinformation.getBk_beginamount();
+            Double inbeginamount = inbankinformation.getBk_beginamount()== null ? new Double(0) : inbankinformation.getBk_beginamount();
             Double inspending = inbankinformation.getBk_spending() == null ? new Double(0) : inbankinformation.getBk_spending();
             Double inincomme = inbankinformation.getBk_income() == null ? new Double(0) : inbankinformation.getBk_income();
             inbankinformation.setBk_thisamount(inbeginamount + inincomme - inspending - bk_amount);
@@ -314,9 +314,13 @@ public class FundtransferServiceImpl extends CommonBaseServiceImpl<FundtransferM
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
         Long companyId = BaseContextHolder.getCompanyId();
-        Integer count = "0".equals(String.valueOf(id)) ? fundtransferMapper.validateCodeWhenInsert(code, companyId) :
-                fundtransferMapper.validateCodeWhenUpdate(code, id, companyId);
-        return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.FUNDTRANSFER.getCaller()).getData();
+        String codeString = null;
+        synchronized(FundtransferServiceImpl.class) {
+            Integer count = "0".equals(String.valueOf(id)) ? fundtransferMapper.validateCodeWhenInsert(code, companyId) :
+                    fundtransferMapper.validateCodeWhenUpdate(code, id, companyId);
+            codeString = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.FUNDTRANSFER.getCaller()).getData();
+        }
+        return codeString;
     }
 
     private List<Fundtransfer> getListByMode(ListReqDTO req) {

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

@@ -316,9 +316,13 @@ public class OthreceiptsServiceImpl extends CommonBaseServiceImpl<OthreceiptsMap
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
         Long companyId = BaseContextHolder.getCompanyId();
-        Integer count = "0".equals(String.valueOf(id)) ? othreceiptsMapper.validateCodeWhenInsert(code, companyId) :
-                othreceiptsMapper.validateCodeWhenUpdate(code, id, companyId);
-        return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.OTHRECEIPTS.getCaller()).getData();
+        String codeString = null;
+        synchronized(OthreceiptsServiceImpl.class) {
+            Integer count = "0".equals(String.valueOf(id)) ? othreceiptsMapper.validateCodeWhenInsert(code, companyId) :
+                    othreceiptsMapper.validateCodeWhenUpdate(code, id, companyId);
+            codeString = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.OTHRECEIPTS.getCaller()).getData();
+        }
+        return codeString;
     }
 
     private List<Othreceipts> getListByMode(ListReqDTO req) {

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

@@ -341,9 +341,13 @@ public class OthspendingsServiceImpl extends CommonBaseServiceImpl<OthspendingsM
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
         Long companyId = BaseContextHolder.getCompanyId();
-        Integer count = "0".equals(String.valueOf(id)) ? othspendingsMapper.validateCodeWhenInsert(code, companyId) :
-                othspendingsMapper.validateCodeWhenUpdate(code, id, companyId);
-        return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.OTHSPENDINGS.getCaller()).getData();
+        String codeString = null;
+        synchronized(OthspendingsServiceImpl.class) {
+            Integer count = "0".equals(String.valueOf(id)) ? othspendingsMapper.validateCodeWhenInsert(code, companyId) :
+                    othspendingsMapper.validateCodeWhenUpdate(code, id, companyId);
+            codeString = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.OTHSPENDINGS.getCaller()).getData();
+        }
+        return codeString;
     }
 
     private List<Othspendings> getListByMode(ListReqDTO req) {

+ 7 - 3
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/PaybalanceServiceImpl.java

@@ -458,9 +458,13 @@ public class PaybalanceServiceImpl extends CommonBaseServiceImpl<PaybalanceMappe
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
         Long companyId = BaseContextHolder.getCompanyId();
-        Integer count = "0".equals(String.valueOf(id)) ? paybalanceMapper.validateCodeWhenInsert(code, companyId) :
-                paybalanceMapper.validateCodeWhenUpdate(code, id, companyId);
-        return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PAYBALANCE.getCaller()).getData();
+        String codeString = null;
+        synchronized(PaybalanceServiceImpl.class) {
+            Integer count = "0".equals(String.valueOf(id)) ? paybalanceMapper.validateCodeWhenInsert(code, companyId) :
+                    paybalanceMapper.validateCodeWhenUpdate(code, id, companyId);
+            codeString = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PAYBALANCE.getCaller()).getData();
+        }
+        return codeString;
     }
 
     private List<Paybalance> getListByMode(ListReqDTO req) {

+ 7 - 3
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/RecbalanceServiceImpl.java

@@ -463,9 +463,13 @@ public class RecbalanceServiceImpl extends CommonBaseServiceImpl<RecbalanceMappe
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
         Long companyId = BaseContextHolder.getCompanyId();
-        Integer count = "0".equals(String.valueOf(id)) ? recbalanceMapper.validateCodeWhenInsert(code, companyId) :
-                recbalanceMapper.validateCodeWhenUpdate(code, id, companyId);
-        return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.RECBALANCE.getCaller()).getData();
+        String codeString = null;
+        synchronized(RecbalanceServiceImpl.class) {
+            Integer count = "0".equals(String.valueOf(id)) ? recbalanceMapper.validateCodeWhenInsert(code, companyId) :
+                    recbalanceMapper.validateCodeWhenUpdate(code, id, companyId);
+            codeString = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.RECBALANCE.getCaller()).getData();
+        }
+        return codeString;
     }
 
     private List<Recbalance> getListByMode(ListReqDTO req) {