正在显示
4 个修改的文件
包含
21 行增加
和
24 行删除
@@ -11,9 +11,5 @@ require ( | @@ -11,9 +11,5 @@ require ( | ||
11 | github.com/linmadan/egglib-go v0.0.0-20191217144343-ca4539f95bf9 | 11 | github.com/linmadan/egglib-go v0.0.0-20191217144343-ca4539f95bf9 |
12 | github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect | 12 | github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect |
13 | github.com/shopspring/decimal v1.2.0 | 13 | github.com/shopspring/decimal v1.2.0 |
14 | - github.com/tiptok/gocomm v1.0.2 | ||
15 | -) | ||
16 | - | ||
17 | -replace ( | ||
18 | - github.com/tiptok/gocomm v1.0.2 => F:\go\src\learn_project\gocomm | 14 | + github.com/tiptok/gocomm v1.0.5 |
19 | ) | 15 | ) |
@@ -14,7 +14,7 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis | @@ -14,7 +14,7 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis | ||
14 | var ( | 14 | var ( |
15 | transactionContext, _ = factory.CreateTransactionContext(nil) | 15 | transactionContext, _ = factory.CreateTransactionContext(nil) |
16 | OrderBaseResponsitory, _ = factory.CreateOrderBaseRepository(transactionContext) | 16 | OrderBaseResponsitory, _ = factory.CreateOrderBaseRepository(transactionContext) |
17 | - BusinessBonusRepository, _ = factory.CreateBusinessBonusRepository(transactionContext) | 17 | + //BusinessBonusRepository, _ = factory.CreateBusinessBonusRepository(transactionContext) |
18 | ) | 18 | ) |
19 | if err = transactionContext.StartTransaction(); err != nil { | 19 | if err = transactionContext.StartTransaction(); err != nil { |
20 | return nil, err | 20 | return nil, err |
@@ -40,17 +40,17 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis | @@ -40,17 +40,17 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis | ||
40 | bonusQuarters := QuartersBonusStatics(orderBetween, 0) | 40 | bonusQuarters := QuartersBonusStatics(orderBetween, 0) |
41 | 41 | ||
42 | // 业务分红统计 | 42 | // 业务分红统计 |
43 | - if bonus, e := BusinessBonusRepository.FindOne(map[string]interface{}{"partner_id": request.PartnerId, "isDisable": 1}); e == nil { | ||
44 | - bonusAll.Receivable += bonus.Bonus | ||
45 | - bonusAll.Received += bonus.BonusHas | ||
46 | - bonusAll.Outstanding += bonus.BonusNot | ||
47 | - if bonus.UpdateAt.Unix() >= (request.StartTime/1000) && bonus.UpdateAt.Unix() < (request.EndTime/1000) { | ||
48 | - q := quarter(bonus.UpdateAt) | ||
49 | - bonusQuarters[q].Receivable += bonus.Bonus | ||
50 | - bonusQuarters[q].Received += bonus.BonusHas | ||
51 | - bonusQuarters[q].Outstanding += bonus.BonusNot | ||
52 | - } | ||
53 | - } | 43 | + //if bonus, e := BusinessBonusRepository.FindOne(map[string]interface{}{"partner_id": request.PartnerId, "isDisable": 1}); e == nil { |
44 | + // bonusAll.Receivable += bonus.Bonus | ||
45 | + // bonusAll.Received += bonus.BonusHas | ||
46 | + // bonusAll.Outstanding += bonus.BonusNot | ||
47 | + // if bonus.UpdateAt.Unix() >= (request.StartTime/1000) && bonus.UpdateAt.Unix() < (request.EndTime/1000) { | ||
48 | + // q := quarter(bonus.UpdateAt) | ||
49 | + // bonusQuarters[q].Receivable += bonus.Bonus | ||
50 | + // bonusQuarters[q].Received += bonus.BonusHas | ||
51 | + // bonusQuarters[q].Outstanding += bonus.BonusNot | ||
52 | + // } | ||
53 | + //} | ||
54 | 54 | ||
55 | rsp = &protocol.DividendStatisticsResponse{} | 55 | rsp = &protocol.DividendStatisticsResponse{} |
56 | rsp.Statistics = protocol.DividendStatistics{ | 56 | rsp.Statistics = protocol.DividendStatistics{ |
@@ -177,7 +177,7 @@ func Statistics(header *protocol.RequestHeader, request *protocol.OrderStatistic | @@ -177,7 +177,7 @@ func Statistics(header *protocol.RequestHeader, request *protocol.OrderStatistic | ||
177 | func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (rsp *protocol.OrderListResponse, err error) { | 177 | func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (rsp *protocol.OrderListResponse, err error) { |
178 | var ( | 178 | var ( |
179 | transactionContext, _ = factory.CreateTransactionContext(nil) | 179 | transactionContext, _ = factory.CreateTransactionContext(nil) |
180 | - OrderResponsitory, _ = factory.CreateOrderBaseRepository(transactionContext) | 180 | + OrderRepository, _ = factory.CreateOrderBaseRepository(transactionContext) |
181 | OrderDao, _ = factory.CreateOrderBaseDao(transactionContext) | 181 | OrderDao, _ = factory.CreateOrderBaseDao(transactionContext) |
182 | orders []*domain.OrderBase | 182 | orders []*domain.OrderBase |
183 | total int64 | 183 | total int64 |
@@ -200,6 +200,8 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r | @@ -200,6 +200,8 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r | ||
200 | SortByUpdateTime: domain.DESC, | 200 | SortByUpdateTime: domain.DESC, |
201 | PartnerId: request.PartnerId, | 201 | PartnerId: request.PartnerId, |
202 | PartnerCategoryId: request.JoinWay, | 202 | PartnerCategoryId: request.JoinWay, |
203 | + OrderType: request.OrderType, | ||
204 | + OrderTypes: request.OrderTypes, | ||
203 | } | 205 | } |
204 | if request.StartTime > 0 { | 206 | if request.StartTime > 0 { |
205 | queryOption.BeginTime = time.Unix(request.StartTime/1000, 0) | 207 | queryOption.BeginTime = time.Unix(request.StartTime/1000, 0) |
@@ -207,21 +209,18 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r | @@ -207,21 +209,18 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r | ||
207 | if request.EndTime > 0 { | 209 | if request.EndTime > 0 { |
208 | queryOption.EndTime = time.Unix(request.EndTime/1000, 0) | 210 | queryOption.EndTime = time.Unix(request.EndTime/1000, 0) |
209 | } | 211 | } |
210 | - queryOption.OrderType = request.OrderType | ||
211 | - queryOption.OrderTypes = request.OrderTypes | ||
212 | - total, orders, _ = OrderResponsitory.Find(utils.ObjectJsonToMap(queryOption)) | 212 | + total, orders, _ = OrderRepository.Find(utils.ObjectJsonToMap(queryOption)) |
213 | if len(orders) != 0 { | 213 | if len(orders) != 0 { |
214 | for i := range orders { | 214 | for i := range orders { |
215 | rsp.List = append(rsp.List, DomainOrderToOrderListItem(orders[i])) | 215 | rsp.List = append(rsp.List, DomainOrderToOrderListItem(orders[i])) |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | - // 查询统计数据 | 219 | + // 【特殊处理1】 查询第0页时,需要查询累计实发订单数 |
220 | if request.PageIndex == 0 { | 220 | if request.PageIndex == 0 { |
221 | var ( | 221 | var ( |
222 | cumulativeQuantity int | 222 | cumulativeQuantity int |
223 | ) | 223 | ) |
224 | - //累计实发订单 | ||
225 | cumulativeQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{ | 224 | cumulativeQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{ |
226 | EndTime: time.Now().Unix() * 1000, | 225 | EndTime: time.Now().Unix() * 1000, |
227 | OrderTypes: domain.UserOrderTypes(domain.Career), | 226 | OrderTypes: domain.UserOrderTypes(domain.Career), |
@@ -230,7 +229,7 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r | @@ -230,7 +229,7 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r | ||
230 | }) | 229 | }) |
231 | rsp.Total = cumulativeQuantity | 230 | rsp.Total = cumulativeQuantity |
232 | } | 231 | } |
233 | - // 今天累计数量特殊处理,不需要返回所有订单总数(因为要复用rsp.Total字段) | 232 | + //【特殊处理2】 今天累计数量特殊处理 当前查询时间段内所有订单总数(复用rsp.Total字段) |
234 | if request.StartTime > 0 && request.EndTime > 0 { | 233 | if request.StartTime > 0 && request.EndTime > 0 { |
235 | zero := time.Time(xtime.XTime(time.Now()).DayBefore(0)).Unix() | 234 | zero := time.Time(xtime.XTime(time.Now()).DayBefore(0)).Unix() |
236 | if request.StartTime == (zero * 1000) { | 235 | if request.StartTime == (zero * 1000) { |
@@ -146,7 +146,9 @@ func (m *OrderBase) OrderBonusStatic() *OrderStatics { | @@ -146,7 +146,9 @@ func (m *OrderBase) OrderBonusStatic() *OrderStatics { | ||
146 | 146 | ||
147 | type OrderQueryOption struct { | 147 | type OrderQueryOption struct { |
148 | PartnerId int64 `json:"partnerId,omitempty"` | 148 | PartnerId int64 `json:"partnerId,omitempty"` |
149 | + // 订单类型 单个 | ||
149 | OrderType int `json:"orderType,omitempty"` | 150 | OrderType int `json:"orderType,omitempty"` |
151 | + // 订单类型 多个 | ||
150 | OrderTypes []int `json:"orderTypes,omitempty"` | 152 | OrderTypes []int `json:"orderTypes,omitempty"` |
151 | OrderStatus int `json:"orderStatus,omitempty"` | 153 | OrderStatus int `json:"orderStatus,omitempty"` |
152 | BeginTime time.Time `json:"beginTime,omitempty"` | 154 | BeginTime time.Time `json:"beginTime,omitempty"` |
-
请 注册 或 登录 后发表评论