Przeglądaj źródła

Merge branch 'dev' of ssh://10.10.100.21/source/saas-platform into dev

zhuth 7 lat temu
rodzic
commit
ddde6aa2c4

+ 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) {

+ 7 - 4
base-servers/socket/socket-api/src/main/java/com/usoftchina/saas/socket/api/SocketMessageApi.java

@@ -4,6 +4,8 @@ import com.usoftchina.saas.base.Result;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 
 /**
  * @author yingp
@@ -19,8 +21,9 @@ public interface SocketMessageApi {
      * @param message
      * @return
      */
-    @PostMapping("/message/clients/{clientId}")
-    Result sendToClient(@PathVariable("clientId") String clientId, String dest, String message);
+    @RequestMapping("/message/clients/{clientId}")
+    Result sendToClient(@PathVariable("clientId") String clientId,
+                        @RequestParam(value = "dest", required = false) String dest, String message);
 
     /**
      * 广播信息
@@ -29,6 +32,6 @@ public interface SocketMessageApi {
      * @param message
      * @return
      */
-    @PostMapping("/message/clients")
-    Result sendToAllClients(String dest, String message);
+    @RequestMapping("/message/clients")
+    Result sendToAllClients(@RequestParam(value = "dest", required = false) String dest, String message);
 }

+ 5 - 4
base-servers/socket/socket-server/src/main/java/com/usoftchina/saas/socket/controller/MessageController.java

@@ -25,8 +25,9 @@ public class MessageController {
      * @param message
      * @return
      */
-    @PostMapping("/clients/{clientId}")
-    public Result sendToClient(@PathVariable String clientId, String dest, String message) {
+    @RequestMapping("/clients/{clientId}")
+    public Result sendToClient(@PathVariable String clientId,
+                               @RequestParam(value = "dest", required = false) String dest, String message) {
         /**
          * 前端使用
          * <pre>
@@ -44,8 +45,8 @@ public class MessageController {
      * @param message
      * @return
      */
-    @PostMapping("/clients")
-    public Result sendToAllClients(String dest, String message) {
+    @RequestMapping("/clients")
+    public Result sendToAllClients(@RequestParam(value = "dest", required = false) String dest, String message) {
         /**
          * 前端使用
          * <pre>