正在显示
1 个修改的文件
包含
50 行增加
和
23 行删除
@@ -73,6 +73,7 @@ func StatisticsV2(header *protocol.RequestHeader, request *protocol.DividendStat | @@ -73,6 +73,7 @@ func StatisticsV2(header *protocol.RequestHeader, request *protocol.DividendStat | ||
73 | orderBetween = append(orderBetween, orderAll[i]) | 73 | orderBetween = append(orderBetween, orderAll[i]) |
74 | } | 74 | } |
75 | } | 75 | } |
76 | + | ||
76 | //0:全部分类, | 77 | //0:全部分类, |
77 | //Career int = 1 //事业 | 78 | //Career int = 1 //事业 |
78 | //Business int = 2 //业务 | 79 | //Business int = 2 //业务 |
@@ -86,6 +87,7 @@ func StatisticsV2(header *protocol.RequestHeader, request *protocol.DividendStat | @@ -86,6 +87,7 @@ func StatisticsV2(header *protocol.RequestHeader, request *protocol.DividendStat | ||
86 | bonusAllDevelop protocol.Bonus | 87 | bonusAllDevelop protocol.Bonus |
87 | bonusAllApp protocol.Bonus | 88 | bonusAllApp protocol.Bonus |
88 | ) | 89 | ) |
90 | + { | ||
89 | for _, val := range orderAll { | 91 | for _, val := range orderAll { |
90 | static := val.OrderBonusStatic() | 92 | static := val.OrderBonusStatic() |
91 | bonusAll.Received = utils.Decimal(bonusAll.Received + static.OrderBonusReceive()) | 93 | bonusAll.Received = utils.Decimal(bonusAll.Received + static.OrderBonusReceive()) |
@@ -113,6 +115,7 @@ func StatisticsV2(header *protocol.RequestHeader, request *protocol.DividendStat | @@ -113,6 +115,7 @@ func StatisticsV2(header *protocol.RequestHeader, request *protocol.DividendStat | ||
113 | bonusAllDevelop.Receivable = utils.Decimal(bonusAllDevelop.Receivable + static.OrderTotalReceivable()) | 115 | bonusAllDevelop.Receivable = utils.Decimal(bonusAllDevelop.Receivable + static.OrderTotalReceivable()) |
114 | } | 116 | } |
115 | } | 117 | } |
118 | + } | ||
116 | //0:全部分类, | 119 | //0:全部分类, |
117 | //Career int = 1 //事业 | 120 | //Career int = 1 //事业 |
118 | //Business int = 2 //业务 | 121 | //Business int = 2 //业务 |
@@ -126,29 +129,16 @@ func StatisticsV2(header *protocol.RequestHeader, request *protocol.DividendStat | @@ -126,29 +129,16 @@ func StatisticsV2(header *protocol.RequestHeader, request *protocol.DividendStat | ||
126 | bonusQuartersDevelop = [4]protocol.Bonus{} | 129 | bonusQuartersDevelop = [4]protocol.Bonus{} |
127 | bonusQuartersApp = [4]protocol.Bonus{} | 130 | bonusQuartersApp = [4]protocol.Bonus{} |
128 | ) | 131 | ) |
129 | - //月度分红 | ||
130 | - var ( | ||
131 | - bonusMonths = [12]protocol.Bonus{} | ||
132 | - bonusMonthsCareer = [12]protocol.Bonus{} | ||
133 | - bonusMonthsBusiness = [12]protocol.Bonus{} | ||
134 | - bonusMonthsDevelop = [12]protocol.Bonus{} | ||
135 | - bonusMonthsApp = [12]protocol.Bonus{} | ||
136 | - ) | 132 | + { |
137 | var ( | 133 | var ( |
138 | quarterNum int // 对应季度在数组中的位置 | 134 | quarterNum int // 对应季度在数组中的位置 |
139 | - monthNum int //对应月份在数组中的位置 | ||
140 | ) | 135 | ) |
141 | for _, val := range orderBetween { | 136 | for _, val := range orderBetween { |
142 | quarterNum = quarter(val.SaleDate) | 137 | quarterNum = quarter(val.SaleDate) |
143 | - monthNum = int(val.SaleDate.Month()) - 1 | ||
144 | static := val.OrderBonusStatic() | 138 | static := val.OrderBonusStatic() |
145 | bonusQuarters[quarterNum].Receivable = utils.Decimal(bonusQuarters[quarterNum].Receivable + static.OrderTotalReceivable()) | 139 | bonusQuarters[quarterNum].Receivable = utils.Decimal(bonusQuarters[quarterNum].Receivable + static.OrderTotalReceivable()) |
146 | bonusQuarters[quarterNum].Received = utils.Decimal(bonusQuarters[quarterNum].Received + static.OrderBonusReceive()) | 140 | bonusQuarters[quarterNum].Received = utils.Decimal(bonusQuarters[quarterNum].Received + static.OrderBonusReceive()) |
147 | bonusQuarters[quarterNum].Outstanding = utils.Decimal(bonusQuarters[quarterNum].Outstanding + static.OrderBonusWait()) | 141 | bonusQuarters[quarterNum].Outstanding = utils.Decimal(bonusQuarters[quarterNum].Outstanding + static.OrderBonusWait()) |
148 | - | ||
149 | - bonusMonths[monthNum].Receivable = utils.Decimal(bonusMonths[monthNum].Receivable + static.OrderTotalReceivable()) | ||
150 | - bonusMonths[monthNum].Received = utils.Decimal(bonusMonths[monthNum].Received + static.OrderBonusReceive()) | ||
151 | - bonusMonths[monthNum].Outstanding = utils.Decimal(bonusMonths[monthNum].Outstanding + static.OrderBonusWait()) | ||
152 | if val.PartnerCategory == nil { | 142 | if val.PartnerCategory == nil { |
153 | continue | 143 | continue |
154 | } | 144 | } |
@@ -159,35 +149,72 @@ func StatisticsV2(header *protocol.RequestHeader, request *protocol.DividendStat | @@ -159,35 +149,72 @@ func StatisticsV2(header *protocol.RequestHeader, request *protocol.DividendStat | ||
159 | bonusQuartersCareer[quarterNum].Received = utils.Decimal(bonusQuartersCareer[quarterNum].Received + static.OrderBonusReceive()) | 149 | bonusQuartersCareer[quarterNum].Received = utils.Decimal(bonusQuartersCareer[quarterNum].Received + static.OrderBonusReceive()) |
160 | bonusQuartersCareer[quarterNum].Outstanding = utils.Decimal(bonusQuartersCareer[quarterNum].Outstanding + static.OrderBonusWait()) | 150 | bonusQuartersCareer[quarterNum].Outstanding = utils.Decimal(bonusQuartersCareer[quarterNum].Outstanding + static.OrderBonusWait()) |
161 | 151 | ||
162 | - bonusMonthsCareer[monthNum].Receivable = utils.Decimal(bonusMonthsCareer[monthNum].Receivable + static.OrderTotalReceivable()) | ||
163 | - bonusMonthsCareer[monthNum].Received = utils.Decimal(bonusMonthsCareer[monthNum].Received + static.OrderBonusReceive()) | ||
164 | - bonusMonthsCareer[monthNum].Outstanding = utils.Decimal(bonusMonthsCareer[monthNum].Outstanding + static.OrderBonusWait()) | ||
165 | case int64(domain.Business): | 152 | case int64(domain.Business): |
166 | bonusQuartersBusiness[quarterNum].Receivable = utils.Decimal(bonusQuartersBusiness[quarterNum].Receivable + static.OrderTotalReceivable()) | 153 | bonusQuartersBusiness[quarterNum].Receivable = utils.Decimal(bonusQuartersBusiness[quarterNum].Receivable + static.OrderTotalReceivable()) |
167 | bonusQuartersBusiness[quarterNum].Received = utils.Decimal(bonusQuartersBusiness[quarterNum].Received + static.OrderBonusReceive()) | 154 | bonusQuartersBusiness[quarterNum].Received = utils.Decimal(bonusQuartersBusiness[quarterNum].Received + static.OrderBonusReceive()) |
168 | bonusQuartersBusiness[quarterNum].Outstanding = utils.Decimal(bonusQuartersBusiness[quarterNum].Outstanding + static.OrderBonusWait()) | 155 | bonusQuartersBusiness[quarterNum].Outstanding = utils.Decimal(bonusQuartersBusiness[quarterNum].Outstanding + static.OrderBonusWait()) |
169 | 156 | ||
170 | - bonusMonthsBusiness[monthNum].Receivable = utils.Decimal(bonusMonthsBusiness[monthNum].Receivable + static.OrderTotalReceivable()) | ||
171 | - bonusMonthsBusiness[monthNum].Received = utils.Decimal(bonusMonthsBusiness[monthNum].Received + static.OrderBonusReceive()) | ||
172 | - bonusMonthsBusiness[monthNum].Outstanding = utils.Decimal(bonusMonthsBusiness[monthNum].Outstanding + static.OrderBonusWait()) | ||
173 | case int64(domain.App): | 157 | case int64(domain.App): |
174 | bonusQuartersApp[quarterNum].Receivable = utils.Decimal(bonusQuartersApp[quarterNum].Receivable + static.OrderTotalReceivable()) | 158 | bonusQuartersApp[quarterNum].Receivable = utils.Decimal(bonusQuartersApp[quarterNum].Receivable + static.OrderTotalReceivable()) |
175 | bonusQuartersApp[quarterNum].Received = utils.Decimal(bonusQuartersApp[quarterNum].Received + static.OrderBonusReceive()) | 159 | bonusQuartersApp[quarterNum].Received = utils.Decimal(bonusQuartersApp[quarterNum].Received + static.OrderBonusReceive()) |
176 | bonusQuartersApp[quarterNum].Outstanding = utils.Decimal(bonusQuartersApp[quarterNum].Outstanding + static.OrderBonusWait()) | 160 | bonusQuartersApp[quarterNum].Outstanding = utils.Decimal(bonusQuartersApp[quarterNum].Outstanding + static.OrderBonusWait()) |
177 | 161 | ||
178 | - bonusMonthsApp[monthNum].Receivable = utils.Decimal(bonusMonthsApp[monthNum].Receivable + static.OrderTotalReceivable()) | ||
179 | - bonusMonthsApp[monthNum].Received = utils.Decimal(bonusMonthsApp[monthNum].Received + static.OrderBonusReceive()) | ||
180 | - bonusMonthsApp[monthNum].Outstanding = utils.Decimal(bonusMonthsApp[monthNum].Outstanding + static.OrderBonusWait()) | ||
181 | case int64(domain.Develop): | 162 | case int64(domain.Develop): |
182 | bonusQuartersDevelop[quarterNum].Receivable = utils.Decimal(bonusQuartersDevelop[quarterNum].Receivable + static.OrderTotalReceivable()) | 163 | bonusQuartersDevelop[quarterNum].Receivable = utils.Decimal(bonusQuartersDevelop[quarterNum].Receivable + static.OrderTotalReceivable()) |
183 | bonusQuartersDevelop[quarterNum].Received = utils.Decimal(bonusQuartersDevelop[quarterNum].Received + static.OrderBonusReceive()) | 164 | bonusQuartersDevelop[quarterNum].Received = utils.Decimal(bonusQuartersDevelop[quarterNum].Received + static.OrderBonusReceive()) |
184 | bonusQuartersDevelop[quarterNum].Outstanding = utils.Decimal(bonusQuartersDevelop[quarterNum].Outstanding + static.OrderBonusWait()) | 165 | bonusQuartersDevelop[quarterNum].Outstanding = utils.Decimal(bonusQuartersDevelop[quarterNum].Outstanding + static.OrderBonusWait()) |
185 | 166 | ||
167 | + } | ||
168 | + } | ||
169 | + } | ||
170 | + | ||
171 | + // 处理分月份的 | ||
172 | + //月度分红 | ||
173 | + var ( | ||
174 | + bonusMonths = [12]protocol.Bonus{} | ||
175 | + bonusMonthsCareer = [12]protocol.Bonus{} | ||
176 | + bonusMonthsBusiness = [12]protocol.Bonus{} | ||
177 | + bonusMonthsDevelop = [12]protocol.Bonus{} | ||
178 | + bonusMonthsApp = [12]protocol.Bonus{} | ||
179 | + ) | ||
180 | + | ||
181 | + { | ||
182 | + //按照自然年过滤数据 | ||
183 | + yearNum := time.Unix(request.StartTime/1000, 0).Local().Year() | ||
184 | + var monthNum int //对应月份在数组中的位置 | ||
185 | + for i, val := range orderAll { | ||
186 | + if orderAll[i].SaleDate.Year() != yearNum { | ||
187 | + continue | ||
188 | + } | ||
189 | + monthNum = int(val.SaleDate.Month()) - 1 | ||
190 | + static := val.OrderBonusStatic() | ||
191 | + bonusMonths[monthNum].Receivable = utils.Decimal(bonusMonths[monthNum].Receivable + static.OrderTotalReceivable()) | ||
192 | + bonusMonths[monthNum].Received = utils.Decimal(bonusMonths[monthNum].Received + static.OrderBonusReceive()) | ||
193 | + bonusMonths[monthNum].Outstanding = utils.Decimal(bonusMonths[monthNum].Outstanding + static.OrderBonusWait()) | ||
194 | + if val.PartnerCategory == nil { | ||
195 | + continue | ||
196 | + } | ||
197 | + // 分类合并计数 | ||
198 | + switch val.PartnerCategory.Id { | ||
199 | + case int64(domain.Career): | ||
200 | + bonusMonthsCareer[monthNum].Receivable = utils.Decimal(bonusMonthsCareer[monthNum].Receivable + static.OrderTotalReceivable()) | ||
201 | + bonusMonthsCareer[monthNum].Received = utils.Decimal(bonusMonthsCareer[monthNum].Received + static.OrderBonusReceive()) | ||
202 | + bonusMonthsCareer[monthNum].Outstanding = utils.Decimal(bonusMonthsCareer[monthNum].Outstanding + static.OrderBonusWait()) | ||
203 | + case int64(domain.Business): | ||
204 | + bonusMonthsBusiness[monthNum].Receivable = utils.Decimal(bonusMonthsBusiness[monthNum].Receivable + static.OrderTotalReceivable()) | ||
205 | + bonusMonthsBusiness[monthNum].Received = utils.Decimal(bonusMonthsBusiness[monthNum].Received + static.OrderBonusReceive()) | ||
206 | + bonusMonthsBusiness[monthNum].Outstanding = utils.Decimal(bonusMonthsBusiness[monthNum].Outstanding + static.OrderBonusWait()) | ||
207 | + case int64(domain.App): | ||
208 | + bonusMonthsApp[monthNum].Receivable = utils.Decimal(bonusMonthsApp[monthNum].Receivable + static.OrderTotalReceivable()) | ||
209 | + bonusMonthsApp[monthNum].Received = utils.Decimal(bonusMonthsApp[monthNum].Received + static.OrderBonusReceive()) | ||
210 | + bonusMonthsApp[monthNum].Outstanding = utils.Decimal(bonusMonthsApp[monthNum].Outstanding + static.OrderBonusWait()) | ||
211 | + case int64(domain.Develop): | ||
186 | bonusMonthsDevelop[monthNum].Receivable = utils.Decimal(bonusMonthsDevelop[monthNum].Receivable + static.OrderTotalReceivable()) | 212 | bonusMonthsDevelop[monthNum].Receivable = utils.Decimal(bonusMonthsDevelop[monthNum].Receivable + static.OrderTotalReceivable()) |
187 | bonusMonthsDevelop[monthNum].Received = utils.Decimal(bonusMonthsDevelop[monthNum].Received + static.OrderBonusReceive()) | 213 | bonusMonthsDevelop[monthNum].Received = utils.Decimal(bonusMonthsDevelop[monthNum].Received + static.OrderBonusReceive()) |
188 | bonusMonthsDevelop[monthNum].Outstanding = utils.Decimal(bonusMonthsDevelop[monthNum].Outstanding + static.OrderBonusWait()) | 214 | bonusMonthsDevelop[monthNum].Outstanding = utils.Decimal(bonusMonthsDevelop[monthNum].Outstanding + static.OrderBonusWait()) |
189 | } | 215 | } |
190 | } | 216 | } |
217 | + } | ||
191 | // 整理输出数据 | 218 | // 整理输出数据 |
192 | rsp = &protocol.DividendStatisticsV2Response{ | 219 | rsp = &protocol.DividendStatisticsV2Response{ |
193 | Statistics: protocol.DividendStatistics{ | 220 | Statistics: protocol.DividendStatistics{ |
-
请 注册 或 登录 后发表评论