|
@@ -13,6 +13,7 @@ import (
|
|
|
"hongze/fms_api/models/crm"
|
|
|
"hongze/fms_api/models/fms"
|
|
|
crmService "hongze/fms_api/services/crm"
|
|
|
+ fmsService "hongze/fms_api/services/fms"
|
|
|
"hongze/fms_api/utils"
|
|
|
"net/http"
|
|
|
"sort"
|
|
@@ -883,23 +884,38 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- var respList fms.CensusSellerList
|
|
|
- respList = list
|
|
|
+ sort.Slice(list, func(i, j int) bool {
|
|
|
+ if req.SortField == 2 {
|
|
|
+ if req.SortType == 2 {
|
|
|
+ return list[i].GroupRate < list[j].GroupRate
|
|
|
+ } else {
|
|
|
+ return list[i].GroupRate > list[j].GroupRate
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if req.SortType == 2 {
|
|
|
+ return list[i].InvoiceAmount < list[j].InvoiceAmount
|
|
|
+ } else {
|
|
|
+ return list[i].InvoiceAmount > list[j].InvoiceAmount
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
- sort.Sort(respList)
|
|
|
+ //var respList fmsService.CensusSellerListByAmountAsc
|
|
|
+ //respList = list
|
|
|
+ //sort.Sort(list)
|
|
|
|
|
|
// 是否导出
|
|
|
if req.IsExport == 1 {
|
|
|
- ExportInvoiceList(c, respList, req)
|
|
|
+ ExportInvoiceList(c, list, req)
|
|
|
return
|
|
|
}
|
|
|
page.SetTotal(int64(len(list)))
|
|
|
baseData := new(base.BaseData)
|
|
|
baseData.SetPage(page)
|
|
|
if req.Current*req.PageSize > int64(len(list)) {
|
|
|
- baseData.SetList(respList[(req.Current-1)*req.PageSize : len(list)])
|
|
|
+ baseData.SetList(list[(req.Current-1)*req.PageSize : len(list)])
|
|
|
} else {
|
|
|
- baseData.SetList(respList[(req.Current-1)*req.PageSize : req.Current*req.PageSize])
|
|
|
+ baseData.SetList(list[(req.Current-1)*req.PageSize : req.Current*req.PageSize])
|
|
|
}
|
|
|
resp.OkData("获取成功", baseData, c)
|
|
|
}
|
|
@@ -1315,15 +1331,30 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- var respList fms.CensusSellerGroupList
|
|
|
- respList = list
|
|
|
+ sort.Slice(list, func(i, j int) bool {
|
|
|
+ if req.SortField == 2 {
|
|
|
+ if req.SortType == 2 {
|
|
|
+ return list[i].GroupRate < list[j].GroupRate
|
|
|
+ } else {
|
|
|
+ return list[i].GroupRate > list[j].GroupRate
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if req.SortType == 2 {
|
|
|
+ return list[i].InvoiceAmount < list[j].InvoiceAmount
|
|
|
+ } else {
|
|
|
+ return list[i].InvoiceAmount > list[j].InvoiceAmount
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
- sort.Sort(respList)
|
|
|
+ //var respList fms.CensusSellerGroupList
|
|
|
+ //respList = list
|
|
|
+ //sort.Sort(respList)
|
|
|
|
|
|
// 是否导出
|
|
|
if req.IsExport == 1 {
|
|
|
- ExportGroupInvoiceList(c, respList, req)
|
|
|
+ ExportGroupInvoiceList(c, list, req)
|
|
|
return
|
|
|
}
|
|
|
- resp.OkData("获取成功", respList, c)
|
|
|
+ resp.OkData("获取成功", list, c)
|
|
|
}
|