作者 陈志颖

test:贡献值排行测试

... ... @@ -43,3 +43,78 @@
}
}
2020/11/22 07:09:28.882 [I] [???:0] http server Running on http://:8082
2020/11/22 07:10:15.403 [D] [server.go:2843] ====>Recv User:<nil> RequestId:GET./cash-pool/cash-pool?companyId=311.1606000215403578000
Auth=
BodyData:{}
2020/11/22 07:10:15.487 [D] [server.go:2843] <====Send RequestId:GET./cash-pool/cash-pool?companyId=311.1606000215403578000 BodyData:{"code":0,"data":{"cashPoolId":14,"cash":2000,"companyId":311,"exchangedCash":1007,"unExchangeCash":993,"exchangedSuMoney":196,"unExchangeSuMoney":1079,"rate":5.14,"lastRate":5,"createTime":"2020-11-18T01:46:49.196257+08:00"},"msg":"ok"}
2020/11/22 07:10:15.487 [D] [server.go:1925] | 127.0.0.1| 200 | 84.082774ms| match| GET  /cash-pool/cash-pool r:/cash-pool/cash-pool
2020/11/22 11:22:27.645 [I] [???:0] http server Running on http://:8082
2020/11/22 11:23:18.492 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./statistics/employees-ranking-list.1606015398492461000
Auth=
BodyData:{
"companyId": 381,
"uid": 3259769335875584,
"rankingType": 1,
"offset": 0,
"limit": 20
}
2020/11/22 11:23:19.065 [D] [server.go:2843] <====Send RequestId:POST./statistics/employees-ranking-list.1606015398492461000 BodyData:{"code":501,"msg":"内部服务出错:ERROR #42883 operator does not exist: text = bigint"}
2020/11/22 11:23:19.066 [D] [server.go:1925] | 127.0.0.1| 200 | 573.724523ms| match| POST  /statistics/employees-ranking-list r:/statistics/employees-ranking-list
2020/11/22 11:23:48.485 [I] [???:0] http server Running on http://:8082
2020/11/22 11:23:53.185 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./statistics/employees-ranking-list.1606015433185629000
Auth=
BodyData:{
"companyId": 381,
"uid": 3259769335875584,
"rankingType": 1,
"offset": 0,
"limit": 20
}
2020/11/22 11:23:53.235 [D] [server.go:2843] <====Send RequestId:POST./statistics/employees-ranking-list.1606015433185629000 BodyData:{"code":501,"msg":"内部服务出错:ERROR #22P02 invalid input syntax for type bigint: \"uid\""}
2020/11/22 11:23:53.235 [D] [server.go:1925] | 127.0.0.1| 200 | 49.819476ms| match| POST  /statistics/employees-ranking-list r:/statistics/employees-ranking-list
2020/11/22 11:24:15.839 [I] [???:0] http server Running on http://:8082
2020/11/22 11:24:18.789 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./statistics/employees-ranking-list.1606015458789256000
Auth=
BodyData:{
"companyId": 381,
"uid": 3259769335875584,
"rankingType": 1,
"offset": 0,
"limit": 20
}
2020/11/22 11:24:18.842 [D] [server.go:2843] <====Send RequestId:POST./statistics/employees-ranking-list.1606015458789256000 BodyData:{"code":501,"msg":"内部服务出错:ERROR #42702 column reference \"uid\" is ambiguous"}
2020/11/22 11:24:18.842 [D] [server.go:1925] | 127.0.0.1| 200 | 53.409638ms| match| POST  /statistics/employees-ranking-list r:/statistics/employees-ranking-list
2020/11/22 11:24:35.823 [I] [???:0] http server Running on http://:8082
2020/11/22 11:24:37.931 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./statistics/employees-ranking-list.1606015477931595000
Auth=
BodyData:{
"companyId": 381,
"uid": 3259769335875584,
"rankingType": 1,
"offset": 0,
"limit": 20
}
2020/11/22 11:24:38.087 [D] [server.go:2843] <====Send RequestId:POST./statistics/employees-ranking-list.1606015477931595000 BodyData:{"code":0,"data":{"currentEmployeeContributions":null,"currentEmployeeWealth":null,"employeesContributions":[{"Uid":3259769335767040,"EmployeeName":"朱武","EmployeesContributions":88000,"Ranking":1},{"Uid":3259769336174592,"EmployeeName":"索超","EmployeesContributions":26117.3,"Ranking":2},{"Uid":3259769336137728,"EmployeeName":"杨志","EmployeesContributions":7132,"Ranking":3},{"Uid":3259769336137728,"EmployeeName":"杨志358","EmployeesContributions":3209.8,"Ranking":4},{"Uid":3259769336383488,"EmployeeName":"张三","EmployeesContributions":-10000,"Ranking":5}],"employeesWealth":[{"Uid":3259769335767040,"EmployeeName":"朱武","EmployeeSuMoney":88100,"Ranking":1},{"Uid":3259769336174592,"EmployeeName":"索超","EmployeeSuMoney":26217.3,"Ranking":2},{"Uid":3259769336137728,"EmployeeName":"杨志","EmployeeSuMoney":7232,"Ranking":3},{"Uid":3259769336070144,"EmployeeName":"杜迁","EmployeeSuMoney":3635,"Ranking":4},{"Uid":3259769336037376,"EmployeeName":"朱贵2","EmployeeSuMoney
2020/11/22 11:24:38.087 [D] [server.go:1925] | 127.0.0.1| 200 | 156.294931ms| match| POST  /statistics/employees-ranking-list r:/statistics/employees-ranking-list
2020/11/22 11:26:28.140 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./statistics/employees-ranking-list.1606015588140732000
Auth=
BodyData:{
"companyId": 381,
"uid": 3259769335875584,
"rankingType": 1,
"offset": 0,
"limit": 20
}
2020/11/22 11:26:28.332 [D] [server.go:2843] <====Send RequestId:POST./statistics/employees-ranking-list.1606015588140732000 BodyData:{"code":0,"data":{"currentEmployeeContributions":null,"currentEmployeeWealth":null,"employeesContributions":[{"Uid":3259769335767040,"EmployeeName":"朱武","EmployeesContributions":88000,"Ranking":1},{"Uid":3259769336174592,"EmployeeName":"索超","EmployeesContributions":26117.3,"Ranking":2},{"Uid":3259769336137728,"EmployeeName":"杨志","EmployeesContributions":7132,"Ranking":3},{"Uid":3259769336137728,"EmployeeName":"杨志358","EmployeesContributions":3209.8,"Ranking":4},{"Uid":3259769336383488,"EmployeeName":"张三","EmployeesContributions":-10000,"Ranking":5}],"employeesWealth":[{"Uid":3259769335767040,"EmployeeName":"朱武","EmployeeSuMoney":88100,"Ranking":1},{"Uid":3259769336174592,"EmployeeName":"索超","EmployeeSuMoney":26217.3,"Ranking":2},{"Uid":3259769336137728,"EmployeeName":"杨志","EmployeeSuMoney":7232,"Ranking":3},{"Uid":3259769336070144,"EmployeeName":"杜迁","EmployeeSuMoney":3635,"Ranking":4},{"Uid":3259769336037376,"EmployeeName":"朱贵2","EmployeeSuMoney
2020/11/22 11:26:28.332 [D] [server.go:1925] | 127.0.0.1| 200 | 191.991596ms| match| POST  /statistics/employees-ranking-list r:/statistics/employees-ranking-list
2020/11/22 11:27:51.715 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./statistics/employees-ranking-list.1606015671715470000
Auth=
BodyData:{
"companyId": 381,
"uid": 3259769335767040,
"rankingType": 1,
"offset": 0,
"limit": 20
}
2020/11/22 11:27:51.988 [D] [server.go:2843] <====Send RequestId:POST./statistics/employees-ranking-list.1606015671715470000 BodyData:{"code":0,"data":{"currentEmployeeContributions":{"Uid":3259769335767040,"EmployeeName":"朱武","EmployeesContributions":88000,"Ranking":1},"currentEmployeeWealth":{"Uid":3259769335767040,"EmployeeName":"朱武","EmployeeSuMoney":88100,"Ranking":1},"employeesContributions":[{"Uid":3259769335767040,"EmployeeName":"朱武","EmployeesContributions":88000,"Ranking":1},{"Uid":3259769336174592,"EmployeeName":"索超","EmployeesContributions":26117.3,"Ranking":2},{"Uid":3259769336137728,"EmployeeName":"杨志","EmployeesContributions":7132,"Ranking":3},{"Uid":3259769336137728,"EmployeeName":"杨志358","EmployeesContributions":3209.8,"Ranking":4},{"Uid":3259769336383488,"EmployeeName":"张三","EmployeesContributions":-10000,"Ranking":5}],"employeesWealth":[{"Uid":3259769335767040,"EmployeeName":"朱武","EmployeeSuMoney":88100,"Ranking":1},{"Uid":3259769336174592,"EmployeeName":"索超","EmployeeSuMoney":26217.3,"Ranking":2},{"Uid":3259769336137728,"EmployeeName":"杨志","EmployeeSuMoney":
2020/11/22 11:27:51.988 [D] [server.go:1925] | 127.0.0.1| 200 | 273.421678ms| match| POST  /statistics/employees-ranking-list r:/statistics/employees-ranking-list
... ...
... ... @@ -312,7 +312,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
tx := dao.transactionContext.PgTx
suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
// 财富值榜单
// 财富值榜单(素币)
queryWealth := tx.Model(suMoneyTransactionRecordModel)
queryWealth = queryWealth.Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint")
queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
... ... @@ -332,7 +332,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
}
queryWealth = queryWealth.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName'")
// 个人财富值子查询
// 个人财富值子查询(个人素币)
queryWealthWith := queryWealth.Order("employee_su_money DESC")
if offset, ok := queryOptions["offset"]; ok {
... ... @@ -356,7 +356,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
return nil, err
}
// 个人财富值排名
// 个人财富值排名(个人素币排名)
queryEmployeeWealth := tx.Model()
queryEmployeeWealth = queryEmployeeWealth.With("t", queryWealthWith)
queryEmployeeWealth = queryEmployeeWealth.Table("t")
... ... @@ -409,7 +409,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
queryContributions = queryContributions.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC) AS ranking")
queryContributions = queryContributions.Where(`su_money_transaction_records.record_type IN (?)`, pg.In([]int{2, 3}))
queryContributions = queryContributions.Where(`e.status = ?`, 1)
queryContributions = queryContributions.Where("e.uid = t.uid::bigint")
queryContributions = queryContributions.Where("su_money_transaction_records.employee->>'uid' = t.uid")
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
queryContributions = queryContributions.Where("e.company_id = ?", companyId)
}
... ...