正在显示
4 个修改的文件
包含
44 行增加
和
23 行删除
@@ -53,7 +53,7 @@ func AllBonusStatics(orders []*domain.OrderBase, action int) (bonus protocol.Bon | @@ -53,7 +53,7 @@ func AllBonusStatics(orders []*domain.OrderBase, action int) (bonus protocol.Bon | ||
53 | o := orders[i] | 53 | o := orders[i] |
54 | bonus.Received = utils.Decimal(bonus.Received + o.OrderBonusReceive()) | 54 | bonus.Received = utils.Decimal(bonus.Received + o.OrderBonusReceive()) |
55 | bonus.Outstanding = utils.Decimal(bonus.Outstanding + o.OrderBonusWait()) | 55 | bonus.Outstanding = utils.Decimal(bonus.Outstanding + o.OrderBonusWait()) |
56 | - bonus.Receivable = utils.Decimal(bonus.Receivable + o.PlanPartnerBonus) | 56 | + bonus.Receivable = utils.Decimal(bonus.Receivable + o.OrderTotalBonus()) |
57 | } | 57 | } |
58 | return | 58 | return |
59 | } | 59 | } |
@@ -64,7 +64,7 @@ func QuartersBonusStatics(orders []*domain.OrderBase, action int) (bonus []proto | @@ -64,7 +64,7 @@ func QuartersBonusStatics(orders []*domain.OrderBase, action int) (bonus []proto | ||
64 | for i := range orders { | 64 | for i := range orders { |
65 | o := orders[i] | 65 | o := orders[i] |
66 | quarter := quarter(o.CreateTime) | 66 | quarter := quarter(o.CreateTime) |
67 | - bonus[quarter].Receivable = utils.Decimal(bonus[quarter].Receivable + o.PlanPartnerBonus) | 67 | + bonus[quarter].Receivable = utils.Decimal(bonus[quarter].Receivable + o.OrderTotalBonus()) |
68 | bonus[quarter].Received = utils.Decimal(bonus[quarter].Received + o.OrderBonusReceive()) | 68 | bonus[quarter].Received = utils.Decimal(bonus[quarter].Received + o.OrderBonusReceive()) |
69 | bonus[quarter].Outstanding = utils.Decimal(bonus[quarter].Outstanding + o.OrderBonusWait()) | 69 | bonus[quarter].Outstanding = utils.Decimal(bonus[quarter].Outstanding + o.OrderBonusWait()) |
70 | //bonus[quarter].Expend = utils.Decimal(bonus[quarter].Expend + o.OrderBonusOutstanding()) | 70 | //bonus[quarter].Expend = utils.Decimal(bonus[quarter].Expend + o.OrderBonusOutstanding()) |
@@ -122,11 +122,12 @@ func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersR | @@ -122,11 +122,12 @@ func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersR | ||
122 | 122 | ||
123 | for i := range orders { | 123 | for i := range orders { |
124 | o := orders[i] | 124 | o := orders[i] |
125 | + s := o.OrderBonusStatic() | ||
125 | item := &protocol.DividendOrderListItem{ | 126 | item := &protocol.DividendOrderListItem{ |
126 | Id: o.Id, | 127 | Id: o.Id, |
127 | DeliveryNo: o.DeliveryCode, | 128 | DeliveryNo: o.DeliveryCode, |
128 | - OrderAmount: o.PlanOrderAmount, | ||
129 | - DividendReceivable: utils.Decimal(o.OrderTotalBonus()), | 129 | + OrderAmount: s.PlanOrderAmount, //s.OrderAmount(), |
130 | + DividendReceivable: utils.Decimal(s.OrderTotalBonus()), | ||
130 | } | 131 | } |
131 | rsp.List = append(rsp.List, item) | 132 | rsp.List = append(rsp.List, item) |
132 | } | 133 | } |
@@ -76,15 +76,16 @@ func orderProducts(order *domain.OrderBase) interface{} { | @@ -76,15 +76,16 @@ func orderProducts(order *domain.OrderBase) interface{} { | ||
76 | var products []map[string]interface{} | 76 | var products []map[string]interface{} |
77 | for i := range order.OrderGood { | 77 | for i := range order.OrderGood { |
78 | good := order.OrderGood[i] | 78 | good := order.OrderGood[i] |
79 | + static := good.OrderBonusStatic() | ||
79 | item := make(map[string]interface{}) | 80 | item := make(map[string]interface{}) |
80 | item["productName"] = good.GoodName | 81 | item["productName"] = good.GoodName |
81 | item["orderCount"] = good.PlanGoodNumber | 82 | item["orderCount"] = good.PlanGoodNumber |
82 | item["orderAmount"] = good.PlanAmount | 83 | item["orderAmount"] = good.PlanAmount |
83 | item["dividendPercent"] = good.PartnerBonusPercent | 84 | item["dividendPercent"] = good.PartnerBonusPercent |
84 | - item["dividendReceivable"] = good.PlanPartnerBonus //应收分红 | ||
85 | - item["dividendReceived"] = good.PartnerBonusHas //已收分红 | ||
86 | - item["dividendUnReceive"] = good.PartnerBonusNot // 未收分红 | ||
87 | - item["dividendExpend"] = good.PartnerBonusExpense //分红支出 | 85 | + item["dividendReceivable"] = static.OrderTotalBonus() //应收分红 |
86 | + item["dividendReceived"] = static.OrderBonusReceive() //已收分红 | ||
87 | + item["dividendUnReceive"] = static.OrderBonusWait() // 未收分红 | ||
88 | + item["dividendExpend"] = static.OrderBonusOutstanding() //分红支出 | ||
88 | if len(good.Remark) > 0 { | 89 | if len(good.Remark) > 0 { |
89 | item["orderUpdateReason"] = good.Remark | 90 | item["orderUpdateReason"] = good.Remark |
90 | } | 91 | } |
@@ -148,6 +149,8 @@ func Statistics(header *protocol.RequestHeader, request *protocol.OrderStatistic | @@ -148,6 +149,8 @@ func Statistics(header *protocol.RequestHeader, request *protocol.OrderStatistic | ||
148 | }); err != nil { | 149 | }); err != nil { |
149 | return | 150 | return |
150 | } | 151 | } |
152 | + rsp.Statistics.TodayRealMoney = utils.Decimal(rsp.Statistics.TodayRealMoney) | ||
153 | + rsp.Statistics.CumulativeMoney = utils.Decimal(rsp.Statistics.CumulativeMoney) | ||
151 | err = transactionContext.CommitTransaction() | 154 | err = transactionContext.CommitTransaction() |
152 | return | 155 | return |
153 | } | 156 | } |
@@ -72,6 +72,21 @@ func (m *OrderGood) Identify() interface{} { | @@ -72,6 +72,21 @@ func (m *OrderGood) Identify() interface{} { | ||
72 | return m.Id | 72 | return m.Id |
73 | } | 73 | } |
74 | 74 | ||
75 | +func (m *OrderGood) OrderBonusStatic() *OrderStatics { | ||
76 | + return &OrderStatics{ | ||
77 | + BonusStatus: int8(m.BonusStatus), | ||
78 | + PlanOrderCount: m.PlanGoodNumber, | ||
79 | + PlanOrderAmount: m.PlanAmount, | ||
80 | + UseOrderCount: m.UseGoodNumber, | ||
81 | + UseOrderAmount: m.UseAmount, | ||
82 | + PlanPartnerBonus: m.PlanPartnerBonus, | ||
83 | + UsePartnerBonus: m.UsePartnerBonus, | ||
84 | + PartnerBonusHas: m.PartnerBonusHas, | ||
85 | + PartnerBonusNot: m.PartnerBonusNot, | ||
86 | + PartnerBonusExpense: m.PartnerBonusExpense, | ||
87 | + } | ||
88 | +} | ||
89 | + | ||
75 | type OrderGoodRepository interface { | 90 | type OrderGoodRepository interface { |
76 | Save(dm *OrderGood) (*OrderGood, error) | 91 | Save(dm *OrderGood) (*OrderGood, error) |
77 | Remove(dm *OrderGood) (*OrderGood, error) | 92 | Remove(dm *OrderGood) (*OrderGood, error) |
@@ -26,29 +26,31 @@ type OrderStatics struct { | @@ -26,29 +26,31 @@ type OrderStatics struct { | ||
26 | PartnerBonusExpense float64 | 26 | PartnerBonusExpense float64 |
27 | } | 27 | } |
28 | 28 | ||
29 | -//订单应收分红 | 29 | +//订单应收分红 = 已收分红 + 未收分红 |
30 | func (m *OrderStatics) OrderTotalBonus() float64 { | 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) | 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) | ||
35 | } | 36 | } |
36 | 37 | ||
37 | -//订单已收分红 | 38 | +//订单已收分红 = 已收分红 |
38 | func (m *OrderStatics) OrderBonusReceive() float64 { | 39 | func (m *OrderStatics) OrderBonusReceive() float64 { |
39 | return utils.Decimal(m.PartnerBonusHas) | 40 | return utils.Decimal(m.PartnerBonusHas) |
40 | } | 41 | } |
41 | 42 | ||
42 | -//订单未收分红 | 43 | +//订单未收分红 = 未收分红 |
43 | func (m *OrderStatics) OrderBonusWait() float64 { | 44 | func (m *OrderStatics) OrderBonusWait() float64 { |
44 | - bonusWait := m.OrderTotalBonus() - m.OrderBonusReceive() | ||
45 | - if bonusWait < 0 { | ||
46 | - return 0 | ||
47 | - } | ||
48 | - return bonusWait | 45 | + //bonusWait := m.OrderTotalBonus() - m.OrderBonusReceive() |
46 | + //if bonusWait < 0 { | ||
47 | + // return 0 | ||
48 | + //} | ||
49 | + //return bonusWait | ||
50 | + return m.PartnerBonusNot | ||
49 | } | 51 | } |
50 | 52 | ||
51 | -//分红支出 | 53 | +//分红支出 = 分红支出 |
52 | func (m *OrderStatics) OrderBonusOutstanding() float64 { | 54 | func (m *OrderStatics) OrderBonusOutstanding() float64 { |
53 | return utils.Decimal(m.PartnerBonusExpense) | 55 | return utils.Decimal(m.PartnerBonusExpense) |
54 | } | 56 | } |
@@ -58,10 +60,10 @@ func (m *OrderStatics) OrderAmountCancel() float64 { | @@ -58,10 +60,10 @@ func (m *OrderStatics) OrderAmountCancel() float64 { | ||
58 | if m.UseOrderAmount < 0 { | 60 | if m.UseOrderAmount < 0 { |
59 | return 0 | 61 | return 0 |
60 | } | 62 | } |
61 | - if m.PlanOrderAmount > m.UseOrderAmount { | 63 | + if m.PlanOrderAmount < m.UseOrderAmount { |
62 | return 0 | 64 | return 0 |
63 | } | 65 | } |
64 | - return utils.Decimal(m.UseOrderAmount - m.PlanOrderAmount) | 66 | + return utils.Decimal(m.PlanOrderAmount - m.UseOrderAmount) |
65 | } | 67 | } |
66 | 68 | ||
67 | //订单金额 | 69 | //订单金额 |
-
请 注册 或 登录 后发表评论