作者 陈志颖

test:贡献值排行测试

@@ -43,3 +43,78 @@ @@ -43,3 +43,78 @@
43 } 43 }
44 } 44 }
45 2020/11/22 07:09:28.882 [I] [???:0] http server Running on http://:8082 45 2020/11/22 07:09:28.882 [I] [???:0] http server Running on http://:8082
  46 +2020/11/22 07:10:15.403 [D] [server.go:2843] ====>Recv User:<nil> RequestId:GET./cash-pool/cash-pool?companyId=311.1606000215403578000
  47 + Auth=
  48 + BodyData:{}
  49 +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"}
  50 +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
  51 +2020/11/22 11:22:27.645 [I] [???:0] http server Running on http://:8082
  52 +2020/11/22 11:23:18.492 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./statistics/employees-ranking-list.1606015398492461000
  53 + Auth=
  54 + BodyData:{
  55 + "companyId": 381,
  56 + "uid": 3259769335875584,
  57 + "rankingType": 1,
  58 + "offset": 0,
  59 + "limit": 20
  60 +}
  61 +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"}
  62 +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
  63 +2020/11/22 11:23:48.485 [I] [???:0] http server Running on http://:8082
  64 +2020/11/22 11:23:53.185 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./statistics/employees-ranking-list.1606015433185629000
  65 + Auth=
  66 + BodyData:{
  67 + "companyId": 381,
  68 + "uid": 3259769335875584,
  69 + "rankingType": 1,
  70 + "offset": 0,
  71 + "limit": 20
  72 +}
  73 +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\""}
  74 +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
  75 +2020/11/22 11:24:15.839 [I] [???:0] http server Running on http://:8082
  76 +2020/11/22 11:24:18.789 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./statistics/employees-ranking-list.1606015458789256000
  77 + Auth=
  78 + BodyData:{
  79 + "companyId": 381,
  80 + "uid": 3259769335875584,
  81 + "rankingType": 1,
  82 + "offset": 0,
  83 + "limit": 20
  84 +}
  85 +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"}
  86 +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
  87 +2020/11/22 11:24:35.823 [I] [???:0] http server Running on http://:8082
  88 +2020/11/22 11:24:37.931 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./statistics/employees-ranking-list.1606015477931595000
  89 + Auth=
  90 + BodyData:{
  91 + "companyId": 381,
  92 + "uid": 3259769335875584,
  93 + "rankingType": 1,
  94 + "offset": 0,
  95 + "limit": 20
  96 +}
  97 +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
  98 +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
  99 +2020/11/22 11:26:28.140 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./statistics/employees-ranking-list.1606015588140732000
  100 + Auth=
  101 + BodyData:{
  102 + "companyId": 381,
  103 + "uid": 3259769335875584,
  104 + "rankingType": 1,
  105 + "offset": 0,
  106 + "limit": 20
  107 +}
  108 +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
  109 +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
  110 +2020/11/22 11:27:51.715 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./statistics/employees-ranking-list.1606015671715470000
  111 + Auth=
  112 + BodyData:{
  113 + "companyId": 381,
  114 + "uid": 3259769335767040,
  115 + "rankingType": 1,
  116 + "offset": 0,
  117 + "limit": 20
  118 +}
  119 +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":
  120 +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 @@ -312,7 +312,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
312 tx := dao.transactionContext.PgTx 312 tx := dao.transactionContext.PgTx
313 suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord) 313 suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
314 314
315 - // 财富值榜单 315 + // 财富值榜单(素币)
316 queryWealth := tx.Model(suMoneyTransactionRecordModel) 316 queryWealth := tx.Model(suMoneyTransactionRecordModel)
317 queryWealth = queryWealth.Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint") 317 queryWealth = queryWealth.Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint")
318 queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid") 318 queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
@@ -332,7 +332,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter @@ -332,7 +332,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
332 } 332 }
333 queryWealth = queryWealth.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName'") 333 queryWealth = queryWealth.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName'")
334 334
335 - // 个人财富值子查询 335 + // 个人财富值子查询(个人素币)
336 queryWealthWith := queryWealth.Order("employee_su_money DESC") 336 queryWealthWith := queryWealth.Order("employee_su_money DESC")
337 337
338 if offset, ok := queryOptions["offset"]; ok { 338 if offset, ok := queryOptions["offset"]; ok {
@@ -356,7 +356,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter @@ -356,7 +356,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
356 return nil, err 356 return nil, err
357 } 357 }
358 358
359 - // 个人财富值排名 359 + // 个人财富值排名(个人素币排名)
360 queryEmployeeWealth := tx.Model() 360 queryEmployeeWealth := tx.Model()
361 queryEmployeeWealth = queryEmployeeWealth.With("t", queryWealthWith) 361 queryEmployeeWealth = queryEmployeeWealth.With("t", queryWealthWith)
362 queryEmployeeWealth = queryEmployeeWealth.Table("t") 362 queryEmployeeWealth = queryEmployeeWealth.Table("t")
@@ -409,7 +409,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter @@ -409,7 +409,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
409 queryContributions = queryContributions.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC) AS ranking") 409 queryContributions = queryContributions.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC) AS ranking")
410 queryContributions = queryContributions.Where(`su_money_transaction_records.record_type IN (?)`, pg.In([]int{2, 3})) 410 queryContributions = queryContributions.Where(`su_money_transaction_records.record_type IN (?)`, pg.In([]int{2, 3}))
411 queryContributions = queryContributions.Where(`e.status = ?`, 1) 411 queryContributions = queryContributions.Where(`e.status = ?`, 1)
412 - queryContributions = queryContributions.Where("e.uid = t.uid::bigint") 412 + queryContributions = queryContributions.Where("su_money_transaction_records.employee->>'uid' = t.uid")
413 if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { 413 if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
414 queryContributions = queryContributions.Where("e.company_id = ?", companyId) 414 queryContributions = queryContributions.Where("e.company_id = ?", companyId)
415 } 415 }