作者 陈志颖

test:支出素币

@@ -207,8 +207,8 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf @@ -207,8 +207,8 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf
207 // 计算个人素币收支(素币明细收支) 207 // 计算个人素币收支(素币明细收支)
208 func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transactionStartTime time.Time, transactionEndTime time.Time) (map[string]interface{}, error) { 208 func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transactionStartTime time.Time, transactionEndTime time.Time) (map[string]interface{}, error) {
209 var ( 209 var (
210 - incomeSuMoney float64 // 收入的素币(2:任务奖励,3:增加 6: 兑换素币撤回)  
211 - expendSuMoney float64 // 消耗的素币(1:兑换物资,4:扣除,5:兑换现金) 210 + incomeSuMoney float64 // 收入的素币(2:任务奖励,3:增加)
  211 + expendSuMoney float64 // 消耗的素币(1:兑换物资,4:扣除)
212 expendSuMoneyExchange float64 // 5: 兑换现金 212 expendSuMoneyExchange float64 // 5: 兑换现金
213 incomeSuMoneyExchangeRestore float64 // 6: 兑换素币撤回 213 incomeSuMoneyExchangeRestore float64 // 6: 兑换素币撤回
214 ) 214 )
@@ -218,7 +218,7 @@ func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transaction @@ -218,7 +218,7 @@ func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transaction
218 if err := tx.Model(suMoneyTransactionRecordModel). 218 if err := tx.Model(suMoneyTransactionRecordModel).
219 ColumnExpr("sum(su_money_transaction_record.su_money) AS income_su_money"). 219 ColumnExpr("sum(su_money_transaction_record.su_money) AS income_su_money").
220 Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid). 220 Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid).
221 - Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3, 6})). 221 + Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3})).
222 Where(`su_money_transaction_record.create_time > ?`, transactionStartTime). 222 Where(`su_money_transaction_record.create_time > ?`, transactionStartTime).
223 Where(`su_money_transaction_record.create_time < ?`, transactionEndTime). 223 Where(`su_money_transaction_record.create_time < ?`, transactionEndTime).
224 Select(&incomeSuMoney); err != nil { 224 Select(&incomeSuMoney); err != nil {
@@ -238,7 +238,7 @@ func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transaction @@ -238,7 +238,7 @@ func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transaction
238 if err := tx.Model(suMoneyTransactionRecordModel). 238 if err := tx.Model(suMoneyTransactionRecordModel).
239 ColumnExpr("sum(su_money_transaction_record.su_money) AS expend_su_money"). 239 ColumnExpr("sum(su_money_transaction_record.su_money) AS expend_su_money").
240 Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid). 240 Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid).
241 - Where(`su_money_transaction_record.record_type =?`, 5). 241 + Where(`su_money_transaction_record.record_type = ?`, 5).
242 Where(`su_money_transaction_record.create_time > ?`, transactionStartTime). 242 Where(`su_money_transaction_record.create_time > ?`, transactionStartTime).
243 Where(`su_money_transaction_record.create_time < ?`, transactionEndTime). 243 Where(`su_money_transaction_record.create_time < ?`, transactionEndTime).
244 Select(&expendSuMoneyExchange); err != nil { 244 Select(&expendSuMoneyExchange); err != nil {
@@ -255,8 +255,8 @@ func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transaction @@ -255,8 +255,8 @@ func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transaction
255 return nil, err 255 return nil, err
256 } 256 }
257 return map[string]interface{}{ 257 return map[string]interface{}{
258 - "incomeSuMoney": incomeSuMoney, // 个人素币收入  
259 - "expendSuMoney": expendSuMoney + expendSuMoneyExchange - incomeSuMoneyExchangeRestore, // 个人素币支出 258 + "incomeSuMoney": incomeSuMoney + incomeSuMoneyExchangeRestore, // 个人素币收入
  259 + "expendSuMoney": expendSuMoney, // 个人素币支出
260 }, nil 260 }, nil
261 } 261 }
262 262