作者 陈志颖

fix:贡献值统计

@@ -548,3 +548,27 @@ @@ -548,3 +548,27 @@
548 } 548 }
549 2020/11/22 22:03:35.205 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/93.1606053815155869000 BodyData:{"code":501,"msg":"内部服务出错:兑换活动截止时间不能重合"} 549 2020/11/22 22:03:35.205 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/93.1606053815155869000 BodyData:{"code":501,"msg":"内部服务出错:兑换活动截止时间不能重合"}
550 2020/11/22 22:03:35.205 [D] [server.go:1925] | 127.0.0.1| 200 | 49.68737ms| match| PUT  /cash-pool/activity/93 r:/cash-pool/activity/:activityId 550 2020/11/22 22:03:35.205 [D] [server.go:1925] | 127.0.0.1| 200 | 49.68737ms| match| PUT  /cash-pool/activity/93 r:/cash-pool/activity/:activityId
  551 +2020/11/22 22:45:26.388 [I] [???:0] http server Running on http://:8082
  552 +2020/11/22 22:50:59.111 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./su-money/contributions-transaction-record-statistics.1606056659110955000
  553 + Auth=
  554 + BodyData:{
  555 + "companyId": 358
  556 +}
  557 +2020/11/22 22:50:59.112 [D] [server.go:2843] <====Send RequestId:POST./su-money/contributions-transaction-record-statistics.1606056659110955000 BodyData:{"code":504,"msg":"参数认证错误:Uid.Required. Can not be empty"}
  558 +2020/11/22 22:50:59.114 [D] [server.go:1925] | 127.0.0.1| 200 | 2.197018ms| match| POST  /su-money/contributions-transaction-record-statistics r:/su-money/contributions-transaction-record-statistics
  559 +2020/11/22 22:52:49.221 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./su-money/contributions-transaction-record-statistics.1606056769220507000
  560 + Auth=
  561 + BodyData:{
  562 + "companyId": 358,
  563 + "uid": 3283680409725952
  564 +}
  565 +2020/11/22 22:52:49.354 [D] [server.go:2843] <====Send RequestId:POST./su-money/contributions-transaction-record-statistics.1606056769220507000 BodyData:{"code":0,"data":{"expendContributions":0,"incomeContributions":0},"msg":"ok"}
  566 +2020/11/22 22:52:49.354 [D] [server.go:1925] | 127.0.0.1| 200 | 134.340842ms| match| POST  /su-money/contributions-transaction-record-statistics r:/su-money/contributions-transaction-record-statistics
  567 +2020/11/22 22:56:39.580 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./su-money/contributions-transaction-record-statistics.1606056999580898000
  568 + Auth=
  569 + BodyData:{
  570 + "companyId": 358,
  571 + "uid": 3278678178210816
  572 +}
  573 +2020/11/22 22:56:39.610 [D] [server.go:2843] <====Send RequestId:POST./su-money/contributions-transaction-record-statistics.1606056999580898000 BodyData:{"code":0,"data":{"expendContributions":0,"incomeContributions":26},"msg":"ok"}
  574 +2020/11/22 22:56:39.611 [D] [server.go:1925] | 127.0.0.1| 200 | 30.413597ms| match| POST  /su-money/contributions-transaction-record-statistics r:/su-money/contributions-transaction-record-statistics
@@ -266,6 +266,12 @@ func (dao *EmployeeDao) CalculateContributionsTransactionRecord(uid int64, trans @@ -266,6 +266,12 @@ func (dao *EmployeeDao) CalculateContributionsTransactionRecord(uid int64, trans
266 ) 266 )
267 tx := dao.transactionContext.PgTx 267 tx := dao.transactionContext.PgTx
268 suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord) 268 suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
  269 +
  270 + if transactionStartTime.IsZero() && transactionEndTime.IsZero() {
  271 + transactionStartTime = time.Date(1970, 1, 1, 0, 0, 0, 0, time.Local)
  272 + transactionEndTime = time.Now()
  273 + }
  274 +
269 // 收入的贡献值 275 // 收入的贡献值
270 if err := tx.Model(suMoneyTransactionRecordModel). 276 if err := tx.Model(suMoneyTransactionRecordModel).
271 ColumnExpr("sum(su_money_transaction_record.su_money) AS income_su_money"). 277 ColumnExpr("sum(su_money_transaction_record.su_money) AS income_su_money").