作者 yangfu

修改:分红统计修改

... ... @@ -51,9 +51,10 @@ func AllBonusStatics(orders []*domain.OrderBase, action int) (bonus protocol.Bon
bonus = protocol.Bonus{}
for i := range orders {
o := orders[i]
bonus.Received = utils.Decimal(bonus.Received + o.OrderBonusReceive())
bonus.Outstanding = utils.Decimal(bonus.Outstanding + o.OrderBonusWait())
bonus.Receivable = utils.Decimal(bonus.Receivable + o.OrderTotalBonus())
static := o.OrderBonusStatic()
bonus.Received = utils.Decimal(bonus.Received + static.OrderBonusReceive())
bonus.Outstanding = utils.Decimal(bonus.Outstanding + static.OrderBonusWait())
bonus.Receivable = utils.Decimal(bonus.Receivable + static.OrderTotalReceivable())
}
return
}
... ... @@ -64,10 +65,10 @@ func QuartersBonusStatics(orders []*domain.OrderBase, action int) (bonus []proto
for i := range orders {
o := orders[i]
quarter := quarter(o.CreateTime)
bonus[quarter].Receivable = utils.Decimal(bonus[quarter].Receivable + o.OrderTotalBonus())
bonus[quarter].Received = utils.Decimal(bonus[quarter].Received + o.OrderBonusReceive())
bonus[quarter].Outstanding = utils.Decimal(bonus[quarter].Outstanding + o.OrderBonusWait())
//bonus[quarter].Expend = utils.Decimal(bonus[quarter].Expend + o.OrderBonusOutstanding())
static := o.OrderBonusStatic()
bonus[quarter].Receivable = utils.Decimal(bonus[quarter].Receivable + static.OrderTotalReceivable())
bonus[quarter].Received = utils.Decimal(bonus[quarter].Received + static.OrderBonusReceive())
bonus[quarter].Outstanding = utils.Decimal(bonus[quarter].Outstanding + static.OrderBonusWait())
}
return
}
... ... @@ -127,7 +128,7 @@ func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersR
Id: o.Id,
DeliveryNo: o.DeliveryCode,
OrderAmount: s.PlanOrderAmount, //s.OrderAmount(),
DividendReceivable: utils.Decimal(s.OrderTotalBonus()),
DividendReceivable: utils.Decimal(s.OrderTotalReceivable()),
}
rsp.List = append(rsp.List, item)
}
... ...
... ... @@ -82,10 +82,10 @@ func orderProducts(order *domain.OrderBase) interface{} {
item["orderCount"] = good.PlanGoodNumber
item["orderAmount"] = good.PlanAmount
item["dividendPercent"] = good.PartnerBonusPercent
item["dividendReceivable"] = static.OrderTotalBonus() //应收分红
item["dividendReceived"] = static.OrderBonusReceive() //已收分红
item["dividendUnReceive"] = static.OrderBonusWait() // 未收分红
item["dividendExpend"] = static.OrderBonusOutstanding() //分红支出
item["dividendReceivable"] = static.OrderTotalReceivable() //应收分红
item["dividendReceived"] = static.OrderBonusReceive() //已收分红
item["dividendUnReceive"] = static.OrderBonusWait() // 未收分红
item["dividendExpend"] = static.OrderBonusOutstanding() //分红支出
if len(good.Remark) > 0 {
item["orderUpdateReason"] = good.Remark
}
... ... @@ -100,12 +100,13 @@ func orderProducts(order *domain.OrderBase) interface{} {
}
func orderTotalStatic(order *domain.OrderBase) interface{} {
item := make(map[string]interface{})
static := order.OrderBonusStatic()
item["totalCount"] = order.PlanOrderCount
item["totalAmount"] = order.PlanOrderAmount
item["totalDividendReceivable"] = order.OrderTotalBonus()
item["totalReceived"] = order.OrderBonusReceive()
item["totalUnReceive"] = order.OrderBonusWait()
item["totalExpend"] = order.OrderBonusOutstanding()
item["totalDividendReceivable"] = static.OrderTotalReceivable()
item["totalReceived"] = static.OrderBonusReceive()
item["totalUnReceive"] = static.OrderBonusWait()
item["totalExpend"] = static.OrderBonusOutstanding()
if order.UseOrderCount > 0 {
item["totalCountAdjust"] = order.UseOrderCount
item["totalAmountAdjust"] = order.UseOrderAmount
... ... @@ -221,7 +222,7 @@ func DomainOrderToOrderListItem(order *domain.OrderBase) *protocol.OrderListItem
DeliveryNo: order.DeliveryCode,
OrderAmount: order.PlanOrderAmount,
UpdateTime: order.UpdateTime.Unix() * 1000,
MyDividend: bonusStatic.OrderTotalBonus(),
MyDividend: bonusStatic.OrderTotalReceivable(),
IsRead: order.IsRead(),
}
}
... ...
... ... @@ -26,13 +26,13 @@ type OrderStatics struct {
PartnerBonusExpense float64
}
//订单应收分红 = 已收分红 + 未收分红
func (m *OrderStatics) OrderTotalBonus() float64 {
//if m.UseOrderCount >= 0 {
// return utils.Decimal(m.UsePartnerBonus + m.PartnerBonusExpense)
//}
//return utils.Decimal(m.PlanPartnerBonus)
return utils.Decimal(m.PartnerBonusHas + m.PartnerBonusNot)
//订单应收分红 = 初始分红 / 有调整 取调整后分红
func (m *OrderStatics) OrderTotalReceivable() float64 {
if m.UseOrderCount >= 0 {
return utils.Decimal(m.UsePartnerBonus)
}
return utils.Decimal(m.PlanPartnerBonus)
//return utils.Decimal(m.PartnerBonusHas + m.PartnerBonusNot)
}
//订单已收分红 = 已收分红
... ...