...
|
...
|
@@ -57,6 +57,7 @@ func (dao *EmployeeDao) TransferSuMoney(uid int64, suMoney float64) error { |
|
|
return err
|
|
|
}
|
|
|
|
|
|
// 计算个人未读消息
|
|
|
func (dao *EmployeeDao) CalculatePersonUnReadNotification(uid int64) (map[string]int, error) {
|
|
|
var unReadSystemNotification int
|
|
|
var unReadInteractionNotification int
|
...
|
...
|
@@ -86,6 +87,7 @@ func (dao *EmployeeDao) CalculatePersonUnReadNotification(uid int64) (map[string |
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
// 计算个人素币情况
|
|
|
func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{}, error) {
|
|
|
var incomeSuMoney float64
|
|
|
var incomeSuMoneyOfYesterday float64
|
...
|
...
|
@@ -233,6 +235,54 @@ func (dao *EmployeeDao) CalculateEmployeesSuMoney(companyId int, startTime time. |
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
//func (dao *EmployeeDao) CalculateEmployeesSuMoney(queryOptions map[string]interface{}) (map[string]interface{}, error) {
|
|
|
// var ret []struct {
|
|
|
// Uid int
|
|
|
// EmployeeName string
|
|
|
// EmployeeSuMoney float64
|
|
|
// }
|
|
|
// tx := dao.transactionContext.PgTx
|
|
|
// var (
|
|
|
// startTime time.Time
|
|
|
// endTime time.Time
|
|
|
// companyId int
|
|
|
// )
|
|
|
// if company, ok := queryOptions["companyId"].(int); ok {
|
|
|
// companyId = company
|
|
|
// }
|
|
|
// if start, ok := queryOptions["startTime"].(time.Time); ok {
|
|
|
// startTime = start
|
|
|
// } else {
|
|
|
// startTime = time.Date(1971, time.Month(1), 1, 0, 0, 0, 0, time.Now().Location())
|
|
|
// }
|
|
|
// if end, ok := queryOptions["endTime"].(time.Time); ok {
|
|
|
// endTime = end
|
|
|
// } else {
|
|
|
// endTime = time.Now()
|
|
|
// }
|
|
|
// fmt.Print(startTime, "\n")
|
|
|
// fmt.Print(endTime, "\n")
|
|
|
// fmt.Print(companyId, "\n")
|
|
|
// suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
|
|
|
// if err := tx.Model(suMoneyTransactionRecordModel).Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint").
|
|
|
// ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid").
|
|
|
// ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name").
|
|
|
// ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money").
|
|
|
// Where(`e.company_id = ?`, companyId).
|
|
|
// Where(`e.status = ?`, 1).
|
|
|
// Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3})). // 增加,任务奖励的
|
|
|
// Where(`su_money_transaction_record.create_time > ?`, startTime).
|
|
|
// Where(`su_money_transaction_record.create_time < ?`, endTime).
|
|
|
// Group("su_money_transaction_record.employee").
|
|
|
// Order("employee_su_money DESC").
|
|
|
// Select(&ret); err != nil {
|
|
|
// return nil, err
|
|
|
// }
|
|
|
// return map[string]interface{}{
|
|
|
// "employeesSuMoney": ret,
|
|
|
// }, nil
|
|
|
//}
|
|
|
|
|
|
// 员工贡献值统计
|
|
|
func (dao *EmployeeDao) CalculateEmployeesContributions(companyId int, startTime time.Time, endTime time.Time) (map[string]interface{}, error) {
|
|
|
var ret []struct { // 员工贡献值
|
...
|
...
|
|