作者 yangfu

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

... ... @@ -147,8 +147,13 @@ func OrderList(header *protocol.RequestHeader, request *protocol.OrderListReques
_, orders, _ = OrderResponsitory.Find(utils.ObjectJsonToMap(queryOption))
//统计数据
if request.PageIndex == 0 {
var (
partShipmentQuantity, allShipmentQuantity int
//cumulativeQuantity,
intentionQuantity int
)
//部分发货的订单数量
rsp.Statistics["partShipmentQuantity"], _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
partShipmentQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
EndTime: request.EndTime,
BeginTime: request.StartTime,
OrderType: domain.OrderReal,
... ... @@ -156,23 +161,20 @@ func OrderList(header *protocol.RequestHeader, request *protocol.OrderListReques
OrderStatus: domain.OrderStatusDeliverSome,
})
//全部发货的订单数量
rsp.Statistics["allShipmentQuantity"], _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
allShipmentQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
EndTime: request.EndTime,
BeginTime: request.StartTime,
OrderType: domain.OrderReal,
PartnerId: header.UserId,
OrderStatus: domain.OrderStatusDeliverAll,
})
var (
cumulativeQuantity, intentionQuantity int
)
//累计实发订单
cumulativeQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
EndTime: request.EndTime,
BeginTime: request.StartTime,
OrderType: domain.OrderReal,
PartnerId: header.UserId,
})
//cumulativeQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
// EndTime: request.EndTime,
// BeginTime: request.StartTime,
// OrderType: domain.OrderReal,
// PartnerId: header.UserId,
//})
//累计意向订单
intentionQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
EndTime: request.EndTime,
... ... @@ -181,8 +183,10 @@ func OrderList(header *protocol.RequestHeader, request *protocol.OrderListReques
PartnerId: header.UserId,
})
//订单数量
rsp.Statistics["orderQuantity"] = cumulativeQuantity + intentionQuantity
rsp.Statistics["cumulativeQuantity"] = cumulativeQuantity
rsp.Statistics["partShipmentQuantity"] = partShipmentQuantity
rsp.Statistics["allShipmentQuantity"] = allShipmentQuantity
rsp.Statistics["orderQuantity"] = partShipmentQuantity + allShipmentQuantity //所有订单 = 部分发货 + 已经发货
rsp.Statistics["cumulativeQuantity"] = partShipmentQuantity + allShipmentQuantity //实发订单 = 部分发货 + 全部发货
rsp.Statistics["intentionQuantity"] = intentionQuantity
}
... ...
... ... @@ -16,9 +16,11 @@ type OrderDao struct {
func (dao *OrderDao) OrderStatics(option *domain.OrderStaticQuery) (count int, amount float64, err error) {
tx := dao.transactionContext.PgTx
order := new(models.Order)
var orderAmount float64
q := tx.Model(order)
q.ColumnExpr("count(*) count")
q.ColumnExpr("sum(order_actual_amount) total_order_amount")
q.ColumnExpr("sum(order_actual_amount) total_order_actual_amount")
q.ColumnExpr("sum(order_amount) total_order_amount")
if option.PartnerId > 0 {
q.Where(`"order".partner_id =?`, option.PartnerId)
}
... ... @@ -34,7 +36,10 @@ func (dao *OrderDao) OrderStatics(option *domain.OrderStaticQuery) (count int, a
if option.EndTime > 0 {
q.Where(`"order".create_at <?`, time.Unix(option.EndTime/1000, 0))
}
err = q.Select(&count, &amount)
err = q.Select(&count, &amount, &orderAmount)
if option.OrderType == domain.OrderIntention { //意向订单值只有 order_amount order_actual_amount还未赋值
amount = orderAmount
}
return
}
... ...
... ... @@ -130,5 +130,10 @@ func (this *UserController) ChangePassword() {
return
}
header := this.GetRequestHeader(this.Ctx)
msg = protocol.NewReturnResponse(user.ChangePassword(header, request))
data, err := user.ChangePassword(header, request)
if err == nil {
msg = protocol.NewResponseMessage(0, "修改密码成功")
return
}
msg = protocol.NewReturnResponse(data, err)
}
... ...
... ... @@ -18,7 +18,7 @@ func CreateRequstLogFilter(logger *logs.BeeLogger) func(ctx *context.Context) {
if ctx.Input.GetData("requestBody") != nil {
body = string(ctx.Input.GetData("requestBody").([]byte))
}
logger.Debug(fmt.Sprintf("====>Recv User:%v RequestId:%s BodyData:%s", ctx.Input.GetData("UserId"), requestId, body))
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))
}
}
... ...