作者 yangfu

fix : 公司统计修改

@@ -142,10 +142,10 @@ func getJoinWays(transactionContext *transaction.TransactionContext) (joinWays [ @@ -142,10 +142,10 @@ func getJoinWays(transactionContext *transaction.TransactionContext) (joinWays [
142 // 获取公司统计 142 // 获取公司统计
143 func getStatistics(userId int64, transactionContext *transaction.TransactionContext) (interface{}, error) { 143 func getStatistics(userId int64, transactionContext *transaction.TransactionContext) (interface{}, error) {
144 var ( 144 var (
145 - UsersRepository, _ = factory.CreateUsersRepository(transactionContext)  
146 - PartnerInfoDao, _ = factory.CreatePartnerInfoDao(transactionContext)  
147 - OrderBaseDao, _ = factory.CreateOrderBaseDao(transactionContext)  
148 - BusinessBonusDao, _ = factory.CreateBusinessBonusDao(transactionContext) 145 + UsersRepository, _ = factory.CreateUsersRepository(transactionContext)
  146 + PartnerInfoDao, _ = factory.CreatePartnerInfoDao(transactionContext)
  147 + OrderBaseDao, _ = factory.CreateOrderBaseDao(transactionContext)
  148 + //BusinessBonusDao, _ = factory.CreateBusinessBonusDao(transactionContext)
149 //user *domain.Users 149 //user *domain.Users
150 partnerIds []int64 150 partnerIds []int64
151 ) 151 )
@@ -156,6 +156,10 @@ func getStatistics(userId int64, transactionContext *transaction.TransactionCont @@ -156,6 +156,10 @@ func getStatistics(userId int64, transactionContext *transaction.TransactionCont
156 partnerIds = user.AccessPartnerIds() 156 partnerIds = user.AccessPartnerIds()
157 } 157 }
158 Statistics := make(map[string]interface{}) 158 Statistics := make(map[string]interface{})
  159 + //Statistics["developDividend"] = 0
  160 + //Statistics["developOrdersMoney"] = 0
  161 + //Statistics["appDividend"] = 0
  162 + //Statistics["appOrdersMoney"] = 0
159 if count, e := PartnerInfoDao.PartnerStatic(map[string]interface{}{"inPartnerIds": partnerIds, "inPartnerCategory": domain.Career}); e == nil { 163 if count, e := PartnerInfoDao.PartnerStatic(map[string]interface{}{"inPartnerIds": partnerIds, "inPartnerCategory": domain.Career}); e == nil {
160 Statistics["careerCount"] = count 164 Statistics["careerCount"] = count
161 } 165 }
@@ -168,18 +172,27 @@ func getStatistics(userId int64, transactionContext *transaction.TransactionCont @@ -168,18 +172,27 @@ func getStatistics(userId int64, transactionContext *transaction.TransactionCont
168 if count, e := PartnerInfoDao.PartnerStatic(map[string]interface{}{"inPartnerIds": partnerIds, "inPartnerCategory": domain.App}); e == nil { 172 if count, e := PartnerInfoDao.PartnerStatic(map[string]interface{}{"inPartnerIds": partnerIds, "inPartnerCategory": domain.App}); e == nil {
169 Statistics["appCount"] = count 173 Statistics["appCount"] = count
170 } 174 }
171 - if bonus, e := OrderBaseDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, OrderTypes: domain.UserOrderTypes(domain.Career)}); e == nil { 175 + if bonus, e := OrderBaseDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, OrderTypes: domain.UserOrderTypes(domain.Career), PartnerCategoryId: domain.Career}); e == nil {
172 Statistics["careerOrdersMoney"] = bonus.TotalOrderAmount 176 Statistics["careerOrdersMoney"] = bonus.TotalOrderAmount
173 Statistics["careerDividend"] = bonus.Bonus 177 Statistics["careerDividend"] = bonus.Bonus
174 } 178 }
175 - if businessBonus, e := BusinessBonusDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, IsDisable: 1}); e == nil {  
176 - Statistics["businessDividend"] = businessBonus.Bonus  
177 - Statistics["businessOrdersMoney"] = businessBonus.TotalOrderAmount 179 + if bonus, e := OrderBaseDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, OrderTypes: domain.UserOrderTypes(domain.Career), PartnerCategoryId: domain.Business}); e == nil {
  180 + Statistics["businessOrdersMoney"] = bonus.TotalOrderAmount
  181 + Statistics["businessDividend"] = bonus.Bonus
178 } 182 }
179 - Statistics["developDividend"] = 0  
180 - Statistics["developOrdersMoney"] = 0  
181 - Statistics["appDividend"] = 0  
182 - Statistics["appOrdersMoney"] = 0 183 + if bonus, e := OrderBaseDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, OrderTypes: domain.UserOrderTypes(domain.Career), PartnerCategoryId: domain.Develop}); e == nil {
  184 + Statistics["developOrdersMoney"] = bonus.TotalOrderAmount
  185 + Statistics["developDividend"] = bonus.Bonus
  186 + }
  187 + if bonus, e := OrderBaseDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, OrderTypes: domain.UserOrderTypes(domain.Career), PartnerCategoryId: domain.App}); e == nil {
  188 + Statistics["appOrdersMoney"] = bonus.TotalOrderAmount
  189 + Statistics["appDividend"] = bonus.Bonus
  190 + }
  191 + //if businessBonus, e := BusinessBonusDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, IsDisable: 1}); e == nil {
  192 + // Statistics["businessDividend"] = businessBonus.Bonus
  193 + // Statistics["businessOrdersMoney"] = businessBonus.TotalOrderAmount
  194 + //}
  195 +
183 Statistics["totalCount"] = len(partnerIds) 196 Statistics["totalCount"] = len(partnerIds)
184 return Statistics, nil 197 return Statistics, nil
185 } 198 }