作者 陈志颖

fix:昨日收益修改

@@ -89,7 +89,7 @@ func (dao *EmployeeDao) CalculatePersonUnReadNotification(uid int64) (map[string @@ -89,7 +89,7 @@ func (dao *EmployeeDao) CalculatePersonUnReadNotification(uid int64) (map[string
89 }, nil 89 }, nil
90 } 90 }
91 91
92 -// 计算个人素币收益,昨日收益:做任务验收获得的素币+额外增加-扣除素币-兑换物资-兑换现金 TODO 92 +// 计算个人素币收益,昨日收益:做任务验收获得的素币+额外增加-扣除素币-兑换物资-兑换现金
93 func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{}, error) { 93 func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{}, error) {
94 var incomeSuMoney float64 94 var incomeSuMoney float64
95 var incomeSuMoneyOfYesterday float64 95 var incomeSuMoneyOfYesterday float64
@@ -110,13 +110,13 @@ func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{ @@ -110,13 +110,13 @@ func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{
110 if err := tx.Model(suMoneyTransactionRecordModel). 110 if err := tx.Model(suMoneyTransactionRecordModel).
111 ColumnExpr("sum(su_money_transaction_record.su_money) AS income_su_money"). 111 ColumnExpr("sum(su_money_transaction_record.su_money) AS income_su_money").
112 Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid). 112 Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid).
113 - Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3, 6})). 113 + Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{4, 1, 5})).
114 Where(`su_money_transaction_record.create_time > ?`, time.Date(yesterday.Year(), yesterday.Month(), yesterday.Day(), 0, 0, 0, 0, time.Local)). 114 Where(`su_money_transaction_record.create_time > ?`, time.Date(yesterday.Year(), yesterday.Month(), yesterday.Day(), 0, 0, 0, 0, time.Local)).
115 Where(`su_money_transaction_record.create_time < ?`, time.Date(yesterday.Year(), yesterday.Month(), yesterday.Day(), 23, 59, 59, 0, time.Local)). 115 Where(`su_money_transaction_record.create_time < ?`, time.Date(yesterday.Year(), yesterday.Month(), yesterday.Day(), 23, 59, 59, 0, time.Local)).
116 Select(&expendSuMoneyOfYesterday); err != nil { 116 Select(&expendSuMoneyOfYesterday); err != nil {
117 return nil, err 117 return nil, err
118 } 118 }
119 - // 收益 119 + // 个人收益
120 if err := tx.Model(suMoneyTransactionRecordModel). 120 if err := tx.Model(suMoneyTransactionRecordModel).
121 ColumnExpr("sum(su_money_transaction_record.su_money) AS income_su_money"). 121 ColumnExpr("sum(su_money_transaction_record.su_money) AS income_su_money").
122 Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid). 122 Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid).
@@ -126,7 +126,7 @@ func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{ @@ -126,7 +126,7 @@ func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{
126 } 126 }
127 return map[string]interface{}{ 127 return map[string]interface{}{
128 "incomeSuMoney": incomeSuMoney, 128 "incomeSuMoney": incomeSuMoney,
129 - "incomeSuMoneyOfYesterday": incomeSuMoneyOfYesterday, 129 + "incomeSuMoneyOfYesterday": incomeSuMoneyOfYesterday - expendSuMoneyOfYesterday,
130 }, nil 130 }, nil
131 } 131 }
132 132
@@ -202,7 +202,7 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf @@ -202,7 +202,7 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf
202 }, nil 202 }, nil
203 } 203 }
204 204
205 -// 计算个人素币收支 205 +// 计算个人素币收支(素币明细收支)
206 func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transactionStartTime time.Time, transactionEndTime time.Time) (map[string]interface{}, error) { 206 func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transactionStartTime time.Time, transactionEndTime time.Time) (map[string]interface{}, error) {
207 var ( 207 var (
208 incomeSuMoney float64 // 收入的素币(2:任务奖励,3:增加 6: 兑换素币撤回) 208 incomeSuMoney float64 // 收入的素币(2:任务奖励,3:增加 6: 兑换素币撤回)
@@ -258,7 +258,7 @@ func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transaction @@ -258,7 +258,7 @@ func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transaction
258 }, nil 258 }, nil
259 } 259 }
260 260
261 -// 计算个人贡献值收支 261 +// 计算个人贡献值收支(贡献明细收支)
262 func (dao *EmployeeDao) CalculateContributionsTransactionRecord(uid int64, transactionStartTime time.Time, transactionEndTime time.Time) (map[string]interface{}, error) { 262 func (dao *EmployeeDao) CalculateContributionsTransactionRecord(uid int64, transactionStartTime time.Time, transactionEndTime time.Time) (map[string]interface{}, error) {
263 var ( 263 var (
264 incomeContributions float64 // 收入的贡献值(2:任务奖励,3:增加) 264 incomeContributions float64 // 收入的贡献值(2:任务奖励,3:增加)