作者 yangfu

修改:分红统计修改

@@ -51,9 +51,10 @@ func AllBonusStatics(orders []*domain.OrderBase, action int) (bonus protocol.Bon @@ -51,9 +51,10 @@ func AllBonusStatics(orders []*domain.OrderBase, action int) (bonus protocol.Bon
51 bonus = protocol.Bonus{} 51 bonus = protocol.Bonus{}
52 for i := range orders { 52 for i := range orders {
53 o := orders[i] 53 o := orders[i]
54 - bonus.Received = utils.Decimal(bonus.Received + o.OrderBonusReceive())  
55 - bonus.Outstanding = utils.Decimal(bonus.Outstanding + o.OrderBonusWait())  
56 - bonus.Receivable = utils.Decimal(bonus.Receivable + o.OrderTotalBonus()) 54 + static := o.OrderBonusStatic()
  55 + bonus.Received = utils.Decimal(bonus.Received + static.OrderBonusReceive())
  56 + bonus.Outstanding = utils.Decimal(bonus.Outstanding + static.OrderBonusWait())
  57 + bonus.Receivable = utils.Decimal(bonus.Receivable + static.OrderTotalReceivable())
57 } 58 }
58 return 59 return
59 } 60 }
@@ -64,10 +65,10 @@ func QuartersBonusStatics(orders []*domain.OrderBase, action int) (bonus []proto @@ -64,10 +65,10 @@ func QuartersBonusStatics(orders []*domain.OrderBase, action int) (bonus []proto
64 for i := range orders { 65 for i := range orders {
65 o := orders[i] 66 o := orders[i]
66 quarter := quarter(o.CreateTime) 67 quarter := quarter(o.CreateTime)
67 - bonus[quarter].Receivable = utils.Decimal(bonus[quarter].Receivable + o.OrderTotalBonus())  
68 - bonus[quarter].Received = utils.Decimal(bonus[quarter].Received + o.OrderBonusReceive())  
69 - bonus[quarter].Outstanding = utils.Decimal(bonus[quarter].Outstanding + o.OrderBonusWait())  
70 - //bonus[quarter].Expend = utils.Decimal(bonus[quarter].Expend + o.OrderBonusOutstanding()) 68 + static := o.OrderBonusStatic()
  69 + bonus[quarter].Receivable = utils.Decimal(bonus[quarter].Receivable + static.OrderTotalReceivable())
  70 + bonus[quarter].Received = utils.Decimal(bonus[quarter].Received + static.OrderBonusReceive())
  71 + bonus[quarter].Outstanding = utils.Decimal(bonus[quarter].Outstanding + static.OrderBonusWait())
71 } 72 }
72 return 73 return
73 } 74 }
@@ -127,7 +128,7 @@ func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersR @@ -127,7 +128,7 @@ func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersR
127 Id: o.Id, 128 Id: o.Id,
128 DeliveryNo: o.DeliveryCode, 129 DeliveryNo: o.DeliveryCode,
129 OrderAmount: s.PlanOrderAmount, //s.OrderAmount(), 130 OrderAmount: s.PlanOrderAmount, //s.OrderAmount(),
130 - DividendReceivable: utils.Decimal(s.OrderTotalBonus()), 131 + DividendReceivable: utils.Decimal(s.OrderTotalReceivable()),
131 } 132 }
132 rsp.List = append(rsp.List, item) 133 rsp.List = append(rsp.List, item)
133 } 134 }
@@ -82,10 +82,10 @@ func orderProducts(order *domain.OrderBase) interface{} { @@ -82,10 +82,10 @@ func orderProducts(order *domain.OrderBase) interface{} {
82 item["orderCount"] = good.PlanGoodNumber 82 item["orderCount"] = good.PlanGoodNumber
83 item["orderAmount"] = good.PlanAmount 83 item["orderAmount"] = good.PlanAmount
84 item["dividendPercent"] = good.PartnerBonusPercent 84 item["dividendPercent"] = good.PartnerBonusPercent
85 - item["dividendReceivable"] = static.OrderTotalBonus() //应收分红  
86 - item["dividendReceived"] = static.OrderBonusReceive() //已收分红  
87 - item["dividendUnReceive"] = static.OrderBonusWait() // 未收分红  
88 - item["dividendExpend"] = static.OrderBonusOutstanding() //分红支出 85 + item["dividendReceivable"] = static.OrderTotalReceivable() //应收分红
  86 + item["dividendReceived"] = static.OrderBonusReceive() //已收分红
  87 + item["dividendUnReceive"] = static.OrderBonusWait() // 未收分红
  88 + item["dividendExpend"] = static.OrderBonusOutstanding() //分红支出
89 if len(good.Remark) > 0 { 89 if len(good.Remark) > 0 {
90 item["orderUpdateReason"] = good.Remark 90 item["orderUpdateReason"] = good.Remark
91 } 91 }
@@ -100,12 +100,13 @@ func orderProducts(order *domain.OrderBase) interface{} { @@ -100,12 +100,13 @@ func orderProducts(order *domain.OrderBase) interface{} {
100 } 100 }
101 func orderTotalStatic(order *domain.OrderBase) interface{} { 101 func orderTotalStatic(order *domain.OrderBase) interface{} {
102 item := make(map[string]interface{}) 102 item := make(map[string]interface{})
  103 + static := order.OrderBonusStatic()
103 item["totalCount"] = order.PlanOrderCount 104 item["totalCount"] = order.PlanOrderCount
104 item["totalAmount"] = order.PlanOrderAmount 105 item["totalAmount"] = order.PlanOrderAmount
105 - item["totalDividendReceivable"] = order.OrderTotalBonus()  
106 - item["totalReceived"] = order.OrderBonusReceive()  
107 - item["totalUnReceive"] = order.OrderBonusWait()  
108 - item["totalExpend"] = order.OrderBonusOutstanding() 106 + item["totalDividendReceivable"] = static.OrderTotalReceivable()
  107 + item["totalReceived"] = static.OrderBonusReceive()
  108 + item["totalUnReceive"] = static.OrderBonusWait()
  109 + item["totalExpend"] = static.OrderBonusOutstanding()
109 if order.UseOrderCount > 0 { 110 if order.UseOrderCount > 0 {
110 item["totalCountAdjust"] = order.UseOrderCount 111 item["totalCountAdjust"] = order.UseOrderCount
111 item["totalAmountAdjust"] = order.UseOrderAmount 112 item["totalAmountAdjust"] = order.UseOrderAmount
@@ -221,7 +222,7 @@ func DomainOrderToOrderListItem(order *domain.OrderBase) *protocol.OrderListItem @@ -221,7 +222,7 @@ func DomainOrderToOrderListItem(order *domain.OrderBase) *protocol.OrderListItem
221 DeliveryNo: order.DeliveryCode, 222 DeliveryNo: order.DeliveryCode,
222 OrderAmount: order.PlanOrderAmount, 223 OrderAmount: order.PlanOrderAmount,
223 UpdateTime: order.UpdateTime.Unix() * 1000, 224 UpdateTime: order.UpdateTime.Unix() * 1000,
224 - MyDividend: bonusStatic.OrderTotalBonus(), 225 + MyDividend: bonusStatic.OrderTotalReceivable(),
225 IsRead: order.IsRead(), 226 IsRead: order.IsRead(),
226 } 227 }
227 } 228 }
@@ -26,13 +26,13 @@ type OrderStatics struct { @@ -26,13 +26,13 @@ type OrderStatics struct {
26 PartnerBonusExpense float64 26 PartnerBonusExpense float64
27 } 27 }
28 28
29 -//订单应收分红 = 已收分红 + 未收分红  
30 -func (m *OrderStatics) OrderTotalBonus() float64 {  
31 - //if m.UseOrderCount >= 0 {  
32 - // return utils.Decimal(m.UsePartnerBonus + m.PartnerBonusExpense)  
33 - //}  
34 - //return utils.Decimal(m.PlanPartnerBonus)  
35 - return utils.Decimal(m.PartnerBonusHas + m.PartnerBonusNot) 29 +//订单应收分红 = 初始分红 / 有调整 取调整后分红
  30 +func (m *OrderStatics) OrderTotalReceivable() float64 {
  31 + if m.UseOrderCount >= 0 {
  32 + return utils.Decimal(m.UsePartnerBonus)
  33 + }
  34 + return utils.Decimal(m.PlanPartnerBonus)
  35 + //return utils.Decimal(m.PartnerBonusHas + m.PartnerBonusNot)
36 } 36 }
37 37
38 //订单已收分红 = 已收分红 38 //订单已收分红 = 已收分红