作者 陈志颖

fix:创建现金池

@@ -578,3 +578,4 @@ @@ -578,3 +578,4 @@
578 2020/11/24 16:04:59.355 [D] [server.go:1925] | 127.0.0.1| 200 | 3.731193052s| match| POST  /cash-pool/activity/exchange-list/import r:/cash-pool/activity/exchange-list/import 578 2020/11/24 16:04:59.355 [D] [server.go:1925] | 127.0.0.1| 200 | 3.731193052s| match| POST  /cash-pool/activity/exchange-list/import r:/cash-pool/activity/exchange-list/import
579 2020/11/24 16:21:47.937 [I] [???:0] http server Running on http://:8082 579 2020/11/24 16:21:47.937 [I] [???:0] http server Running on http://:8082
580 2020/11/24 16:39:53.712 [I] [???:0] http server Running on http://:8082 580 2020/11/24 16:39:53.712 [I] [???:0] http server Running on http://:8082
  581 +2020/11/24 17:29:36.935 [I] [???:0] http server Running on http://:8082
@@ -97,13 +97,13 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co @@ -97,13 +97,13 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
97 systemExchangedSuMoney := systemSuMoneyStatistics["systemExchangedSuMoney"].(float64) // 平台已兑换素币 97 systemExchangedSuMoney := systemSuMoneyStatistics["systemExchangedSuMoney"].(float64) // 平台已兑换素币
98 systemUnExchangeSuMoney := systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64) // 平台未兑换素币 98 systemUnExchangeSuMoney := systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64) // 平台未兑换素币
99 99
  100 +
  101 +
100 // 获取当前公司现金池 102 // 获取当前公司现金池
101 count, cashPools, err := cashPoolRepository.Find(tool_funs.SimpleStructToMap(createCashPoolCommand)) 103 count, cashPools, err := cashPoolRepository.Find(tool_funs.SimpleStructToMap(createCashPoolCommand))
102 if err != nil { 104 if err != nil {
103 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 105 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
104 } 106 }
105 - cashPoolExchangeCash := cashPools[0].ExchangedCash  
106 - cashPoolUnExchangeCash := cashPools[0].UnExchangeCash  
107 107
108 // 不存在现金池 108 // 不存在现金池
109 if count == 0 { // 新增现金池 109 if count == 0 { // 新增现金池
@@ -132,6 +132,9 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co @@ -132,6 +132,9 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
132 return cashPool, nil 132 return cashPool, nil
133 } 133 }
134 } else { // 更新现金池 134 } else { // 更新现金池
  135 + cashPoolExchangeCash := cashPools[0].ExchangedCash
  136 + cashPoolUnExchangeCash := cashPools[0].UnExchangeCash
  137 +
135 if createCashPoolCommand.Cash < cashPoolExchangeCash { 138 if createCashPoolCommand.Cash < cashPoolExchangeCash {
136 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "投入的现金值必须大于当前已兑换现金值") 139 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "投入的现金值必须大于当前已兑换现金值")
137 } 140 }