作者 yangfu

日志修改/订单统计修改/订单详情修改

@@ -147,8 +147,13 @@ func OrderList(header *protocol.RequestHeader, request *protocol.OrderListReques @@ -147,8 +147,13 @@ func OrderList(header *protocol.RequestHeader, request *protocol.OrderListReques
147 _, orders, _ = OrderResponsitory.Find(utils.ObjectJsonToMap(queryOption)) 147 _, orders, _ = OrderResponsitory.Find(utils.ObjectJsonToMap(queryOption))
148 //统计数据 148 //统计数据
149 if request.PageIndex == 0 { 149 if request.PageIndex == 0 {
  150 + var (
  151 + partShipmentQuantity, allShipmentQuantity int
  152 + //cumulativeQuantity,
  153 + intentionQuantity int
  154 + )
150 //部分发货的订单数量 155 //部分发货的订单数量
151 - rsp.Statistics["partShipmentQuantity"], _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{ 156 + partShipmentQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
152 EndTime: request.EndTime, 157 EndTime: request.EndTime,
153 BeginTime: request.StartTime, 158 BeginTime: request.StartTime,
154 OrderType: domain.OrderReal, 159 OrderType: domain.OrderReal,
@@ -156,23 +161,20 @@ func OrderList(header *protocol.RequestHeader, request *protocol.OrderListReques @@ -156,23 +161,20 @@ func OrderList(header *protocol.RequestHeader, request *protocol.OrderListReques
156 OrderStatus: domain.OrderStatusDeliverSome, 161 OrderStatus: domain.OrderStatusDeliverSome,
157 }) 162 })
158 //全部发货的订单数量 163 //全部发货的订单数量
159 - rsp.Statistics["allShipmentQuantity"], _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{ 164 + allShipmentQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
160 EndTime: request.EndTime, 165 EndTime: request.EndTime,
161 BeginTime: request.StartTime, 166 BeginTime: request.StartTime,
162 OrderType: domain.OrderReal, 167 OrderType: domain.OrderReal,
163 PartnerId: header.UserId, 168 PartnerId: header.UserId,
164 OrderStatus: domain.OrderStatusDeliverAll, 169 OrderStatus: domain.OrderStatusDeliverAll,
165 }) 170 })
166 - var (  
167 - cumulativeQuantity, intentionQuantity int  
168 - )  
169 //累计实发订单 171 //累计实发订单
170 - cumulativeQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{  
171 - EndTime: request.EndTime,  
172 - BeginTime: request.StartTime,  
173 - OrderType: domain.OrderReal,  
174 - PartnerId: header.UserId,  
175 - }) 172 + //cumulativeQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
  173 + // EndTime: request.EndTime,
  174 + // BeginTime: request.StartTime,
  175 + // OrderType: domain.OrderReal,
  176 + // PartnerId: header.UserId,
  177 + //})
176 //累计意向订单 178 //累计意向订单
177 intentionQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{ 179 intentionQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
178 EndTime: request.EndTime, 180 EndTime: request.EndTime,
@@ -181,8 +183,10 @@ func OrderList(header *protocol.RequestHeader, request *protocol.OrderListReques @@ -181,8 +183,10 @@ func OrderList(header *protocol.RequestHeader, request *protocol.OrderListReques
181 PartnerId: header.UserId, 183 PartnerId: header.UserId,
182 }) 184 })
183 //订单数量 185 //订单数量
184 - rsp.Statistics["orderQuantity"] = cumulativeQuantity + intentionQuantity  
185 - rsp.Statistics["cumulativeQuantity"] = cumulativeQuantity 186 + rsp.Statistics["partShipmentQuantity"] = partShipmentQuantity
  187 + rsp.Statistics["allShipmentQuantity"] = allShipmentQuantity
  188 + rsp.Statistics["orderQuantity"] = partShipmentQuantity + allShipmentQuantity //所有订单 = 部分发货 + 已经发货
  189 + rsp.Statistics["cumulativeQuantity"] = partShipmentQuantity + allShipmentQuantity //实发订单 = 部分发货 + 全部发货
186 rsp.Statistics["intentionQuantity"] = intentionQuantity 190 rsp.Statistics["intentionQuantity"] = intentionQuantity
187 191
188 } 192 }
@@ -16,9 +16,11 @@ type OrderDao struct { @@ -16,9 +16,11 @@ type OrderDao struct {
16 func (dao *OrderDao) OrderStatics(option *domain.OrderStaticQuery) (count int, amount float64, err error) { 16 func (dao *OrderDao) OrderStatics(option *domain.OrderStaticQuery) (count int, amount float64, err error) {
17 tx := dao.transactionContext.PgTx 17 tx := dao.transactionContext.PgTx
18 order := new(models.Order) 18 order := new(models.Order)
  19 + var orderAmount float64
19 q := tx.Model(order) 20 q := tx.Model(order)
20 q.ColumnExpr("count(*) count") 21 q.ColumnExpr("count(*) count")
21 - q.ColumnExpr("sum(order_actual_amount) total_order_amount") 22 + q.ColumnExpr("sum(order_actual_amount) total_order_actual_amount")
  23 + q.ColumnExpr("sum(order_amount) total_order_amount")
22 if option.PartnerId > 0 { 24 if option.PartnerId > 0 {
23 q.Where(`"order".partner_id =?`, option.PartnerId) 25 q.Where(`"order".partner_id =?`, option.PartnerId)
24 } 26 }
@@ -34,7 +36,10 @@ func (dao *OrderDao) OrderStatics(option *domain.OrderStaticQuery) (count int, a @@ -34,7 +36,10 @@ func (dao *OrderDao) OrderStatics(option *domain.OrderStaticQuery) (count int, a
34 if option.EndTime > 0 { 36 if option.EndTime > 0 {
35 q.Where(`"order".create_at <?`, time.Unix(option.EndTime/1000, 0)) 37 q.Where(`"order".create_at <?`, time.Unix(option.EndTime/1000, 0))
36 } 38 }
37 - err = q.Select(&count, &amount) 39 + err = q.Select(&count, &amount, &orderAmount)
  40 + if option.OrderType == domain.OrderIntention { //意向订单值只有 order_amount order_actual_amount还未赋值
  41 + amount = orderAmount
  42 + }
38 return 43 return
39 } 44 }
40 45
@@ -130,5 +130,10 @@ func (this *UserController) ChangePassword() { @@ -130,5 +130,10 @@ func (this *UserController) ChangePassword() {
130 return 130 return
131 } 131 }
132 header := this.GetRequestHeader(this.Ctx) 132 header := this.GetRequestHeader(this.Ctx)
133 - msg = protocol.NewReturnResponse(user.ChangePassword(header, request)) 133 + data, err := user.ChangePassword(header, request)
  134 + if err == nil {
  135 + msg = protocol.NewResponseMessage(0, "修改密码成功")
  136 + return
  137 + }
  138 + msg = protocol.NewReturnResponse(data, err)
134 } 139 }
@@ -18,7 +18,7 @@ func CreateRequstLogFilter(logger *logs.BeeLogger) func(ctx *context.Context) { @@ -18,7 +18,7 @@ func CreateRequstLogFilter(logger *logs.BeeLogger) func(ctx *context.Context) {
18 if ctx.Input.GetData("requestBody") != nil { 18 if ctx.Input.GetData("requestBody") != nil {
19 body = string(ctx.Input.GetData("requestBody").([]byte)) 19 body = string(ctx.Input.GetData("requestBody").([]byte))
20 } 20 }
21 - logger.Debug(fmt.Sprintf("====>Recv User:%v RequestId:%s BodyData:%s", ctx.Input.GetData("UserId"), requestId, body)) 21 + logger.Debug(fmt.Sprintf("====>Recv User:%v RequestId:%s \n Auth=%v \n BodyData:%s", ctx.Input.GetData("UserId"), requestId, ctx.Input.Header("x-mmm-accesstoken"), body))
22 } 22 }
23 } 23 }
24 24