|
@@ -1154,33 +1154,33 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
}
|
|
|
//total := len(groupList)
|
|
|
groupMap := make(map[int]*crm.SysGroup)
|
|
|
- groupIdSlice := make([]string, 0)
|
|
|
for i := range groupList {
|
|
|
groupMap[groupList[i].GroupId] = groupList[i]
|
|
|
- groupIdSlice = append(groupIdSlice, strconv.Itoa(groupList[i].GroupId))
|
|
|
}
|
|
|
|
|
|
list := make([]*fms.CensusSellerGroupInvoiceItem, 0)
|
|
|
|
|
|
- for k, v := range groupInvoiceMap {
|
|
|
- rate := v / accumulate
|
|
|
- mulNum := decimal.NewFromFloat(100)
|
|
|
- newRate := decimal.NewFromFloat(rate)
|
|
|
- newRate = newRate.Mul(mulNum).Round(2)
|
|
|
- finalRate, _ := newRate.Float64()
|
|
|
+ for groupId, _ := range groupList {
|
|
|
+ if v, ok := groupInvoiceMap[groupId]; ok {
|
|
|
+ rate := v / accumulate
|
|
|
+ mulNum := decimal.NewFromFloat(100)
|
|
|
+ newRate := decimal.NewFromFloat(rate)
|
|
|
+ newRate = newRate.Mul(mulNum).Round(2)
|
|
|
+ finalRate, _ := newRate.Float64()
|
|
|
|
|
|
- amuont, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", v), 64)
|
|
|
+ amuont, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", v), 64)
|
|
|
|
|
|
- groupName := ""
|
|
|
- if groupItem, ok := groupMap[k]; ok {
|
|
|
- groupName = groupItem.GroupName
|
|
|
+ groupName := ""
|
|
|
+ if groupItem, ok := groupMap[k]; ok {
|
|
|
+ groupName = groupItem.GroupName
|
|
|
+ }
|
|
|
+ list = append(list, &fms.CensusSellerGroupInvoiceItem{
|
|
|
+ GroupId: groupId,
|
|
|
+ GroupName: groupName,
|
|
|
+ InvoiceAmount: amuont,
|
|
|
+ GroupRate: finalRate,
|
|
|
+ })
|
|
|
}
|
|
|
- list = append(list, &fms.CensusSellerGroupInvoiceItem{
|
|
|
- GroupId: k,
|
|
|
- GroupName: groupName,
|
|
|
- InvoiceAmount: amuont,
|
|
|
- GroupRate: finalRate,
|
|
|
- })
|
|
|
}
|
|
|
|
|
|
var respList fms.CensusSellerGroupList
|