|
@@ -472,7 +472,6 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
var totalMoneySlice []float64
|
|
|
historyTime, _ := time.Parse(utils.FormatDate, "2023-04-01")
|
|
|
|
|
|
-
|
|
|
// 累计值
|
|
|
var accumulate float64
|
|
|
|
|
@@ -485,7 +484,6 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
startDateTime, _ := time.Parse(utils.FormatDateTime, startDate)
|
|
|
endDateTime, _ := time.Parse(utils.FormatDateTime, endDate)
|
|
|
|
|
|
-
|
|
|
cond := ` 1 = 1 `
|
|
|
historyCond := ` 1=1 `
|
|
|
pars := make([]interface{}, 0)
|
|
@@ -556,7 +554,7 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
|
|
|
// 开票到款金额合计(换算后)
|
|
|
var amountTotal float64
|
|
|
-
|
|
|
+ var amountSum float64
|
|
|
if len(summaryIds) > 0 {
|
|
|
amountCond := `a.id IN ? `
|
|
|
amountPars := make([]interface{}, 0)
|
|
@@ -577,7 +575,7 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
//dataList = append(dataList, results...)
|
|
|
- var amountSum float64
|
|
|
+
|
|
|
for _, result := range results {
|
|
|
amountSum += result.Amount
|
|
|
fmt.Println("result.Amount:", result.Amount)
|
|
@@ -597,31 +595,31 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
}
|
|
|
amountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", amountSum), 64)
|
|
|
accumulate += amountTotal
|
|
|
-
|
|
|
- results, e = fms.GetIncomeHistory(historyCond, historyPars)
|
|
|
- if e != nil {
|
|
|
- resp.FailMsg("查询错误", fmt.Sprintf("获取汇总数据失败, Err: %s", e.Error()), c)
|
|
|
- return
|
|
|
+ amountSum = 0
|
|
|
+ }
|
|
|
+ results, e := fms.GetIncomeHistory(historyCond, historyPars)
|
|
|
+ if e != nil {
|
|
|
+ resp.FailMsg("查询错误", fmt.Sprintf("获取汇总数据失败, Err: %s", e.Error()), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, result := range results {
|
|
|
+ amountSum += result.Amount
|
|
|
+ if _, ok := groupInvoiceMap[result.SellerGroupId]; ok {
|
|
|
+ groupInvoiceMap[result.SellerGroupId] += result.Amount
|
|
|
+ } else {
|
|
|
+ groupInvoiceMap[result.SellerGroupId] = result.Amount
|
|
|
}
|
|
|
- for _, result := range results {
|
|
|
- amountSum += result.Amount
|
|
|
- if _, ok := groupInvoiceMap[result.SellerGroupId]; ok {
|
|
|
- groupInvoiceMap[result.SellerGroupId] += result.Amount
|
|
|
- } else {
|
|
|
- groupInvoiceMap[result.SellerGroupId] = result.Amount
|
|
|
- }
|
|
|
- if _, ok := sellerInvoiceMap[result.FinalSellerId]; ok {
|
|
|
- sellerInvoiceMap[result.FinalSellerId] += result.Amount
|
|
|
- } else {
|
|
|
- sellerInvoiceMap[result.FinalSellerId] = result.Amount
|
|
|
- }
|
|
|
- if _, ok := sellerGroupMap[result.FinalSellerId]; !ok {
|
|
|
- sellerGroupMap[result.FinalSellerId] = result.SellerGroupId
|
|
|
- }
|
|
|
+ if _, ok := sellerInvoiceMap[result.FinalSellerId]; ok {
|
|
|
+ sellerInvoiceMap[result.FinalSellerId] += result.Amount
|
|
|
+ } else {
|
|
|
+ sellerInvoiceMap[result.FinalSellerId] = result.Amount
|
|
|
+ }
|
|
|
+ if _, ok := sellerGroupMap[result.FinalSellerId]; !ok {
|
|
|
+ sellerGroupMap[result.FinalSellerId] = result.SellerGroupId
|
|
|
}
|
|
|
- amountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", amountSum), 64)
|
|
|
- accumulate += amountTotal
|
|
|
}
|
|
|
+ amountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", amountSum), 64)
|
|
|
+ accumulate += amountTotal
|
|
|
} else if startDateTime.After(historyTime) || startDateTime.Equal(historyTime) {
|
|
|
//全部走新查询
|
|
|
//fmt.Println("新查询")
|
|
@@ -729,6 +727,7 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
|
|
|
// 开票到款金额合计(换算后)
|
|
|
var amountTotal float64
|
|
|
+ var amountSum float64
|
|
|
|
|
|
if len(summaryIds) > 0 {
|
|
|
amountCond := `a.id IN ? `
|
|
@@ -750,7 +749,6 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
//dataList = append(dataList, results...)
|
|
|
- var amountSum float64
|
|
|
for _, result := range results {
|
|
|
amountSum += result.Amount
|
|
|
fmt.Println("result.Amount:", result.Amount)
|
|
@@ -770,35 +768,35 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
}
|
|
|
amountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", amountSum), 64)
|
|
|
accumulate += amountTotal
|
|
|
-
|
|
|
- if st != "" && ed != "" {
|
|
|
- historyCond += ` AND (invoice_time BETWEEN ? AND ? )`
|
|
|
- historyPars = append(historyPars, st, ed)
|
|
|
+ amountSum = 0
|
|
|
+ }
|
|
|
+ if st != "" && ed != "" {
|
|
|
+ historyCond += ` AND (invoice_time BETWEEN ? AND ? )`
|
|
|
+ historyPars = append(historyPars, st, ed)
|
|
|
+ }
|
|
|
+ results, e := fms.GetIncomeHistory(historyCond, historyPars)
|
|
|
+ if e != nil {
|
|
|
+ resp.FailMsg("查询错误", fmt.Sprintf("获取汇总数据失败, Err: %s", e.Error()), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, result := range results {
|
|
|
+ amountSum += result.Amount
|
|
|
+ if _, ok := groupInvoiceMap[result.SellerGroupId]; ok {
|
|
|
+ groupInvoiceMap[result.SellerGroupId] += result.Amount
|
|
|
+ } else {
|
|
|
+ groupInvoiceMap[result.SellerGroupId] = result.Amount
|
|
|
}
|
|
|
- results, e = fms.GetIncomeHistory(historyCond, historyPars)
|
|
|
- if e != nil {
|
|
|
- resp.FailMsg("查询错误", fmt.Sprintf("获取汇总数据失败, Err: %s", e.Error()), c)
|
|
|
- return
|
|
|
+ if _, ok := sellerInvoiceMap[result.FinalSellerId]; ok {
|
|
|
+ sellerInvoiceMap[result.FinalSellerId] += result.Amount
|
|
|
+ } else {
|
|
|
+ sellerInvoiceMap[result.FinalSellerId] = result.Amount
|
|
|
}
|
|
|
- for _, result := range results {
|
|
|
- amountSum += result.Amount
|
|
|
- if _, ok := groupInvoiceMap[result.SellerGroupId]; ok {
|
|
|
- groupInvoiceMap[result.SellerGroupId] += result.Amount
|
|
|
- } else {
|
|
|
- groupInvoiceMap[result.SellerGroupId] = result.Amount
|
|
|
- }
|
|
|
- if _, ok := sellerInvoiceMap[result.FinalSellerId]; ok {
|
|
|
- sellerInvoiceMap[result.FinalSellerId] += result.Amount
|
|
|
- } else {
|
|
|
- sellerInvoiceMap[result.FinalSellerId] = result.Amount
|
|
|
- }
|
|
|
- if _, ok := sellerGroupMap[result.FinalSellerId]; !ok {
|
|
|
- sellerGroupMap[result.FinalSellerId] = result.SellerGroupId
|
|
|
- }
|
|
|
+ if _, ok := sellerGroupMap[result.FinalSellerId]; !ok {
|
|
|
+ sellerGroupMap[result.FinalSellerId] = result.SellerGroupId
|
|
|
}
|
|
|
- amountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", amountSum), 64)
|
|
|
- accumulate += amountTotal
|
|
|
}
|
|
|
+ amountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", amountSum), 64)
|
|
|
+ accumulate += amountTotal
|
|
|
}
|
|
|
|
|
|
fmt.Println("totalMoneySlice:", len(totalMoneySlice))
|
|
@@ -886,9 +884,9 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
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(respList[(req.Current-1)*req.PageSize : len(list)])
|
|
|
} else {
|
|
|
- baseData.SetList(respList[(req.Current-1)*req.PageSize:req.Current*req.PageSize])
|
|
|
+ baseData.SetList(respList[(req.Current-1)*req.PageSize : req.Current*req.PageSize])
|
|
|
}
|
|
|
resp.OkData("获取成功", baseData, c)
|
|
|
}
|
|
@@ -988,7 +986,6 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
// historyPars = append(historyPars, sellerIds)
|
|
|
//}
|
|
|
|
|
|
-
|
|
|
var totalMoneySlice []float64
|
|
|
historyTime, _ := time.Parse(utils.FormatDate, "2023-04-01")
|
|
|
|
|
@@ -1009,8 +1006,6 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
startDateTime, _ := time.Parse(utils.FormatDate, req.StartDate)
|
|
|
endDateTime, _ := time.Parse(utils.FormatDate, req.EndDate)
|
|
|
|
|
|
-
|
|
|
-
|
|
|
cond := `1 = 1`
|
|
|
histortyCond := `1 = 1`
|
|
|
pars := make([]interface{}, 0)
|
|
@@ -1048,6 +1043,7 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
|
|
|
// 开票到款金额合计(换算后)
|
|
|
var amountTotal float64
|
|
|
+ var amountSum float64
|
|
|
|
|
|
if len(summaryIds) > 0 {
|
|
|
amountCond := `a.id IN ? `
|
|
@@ -1069,7 +1065,6 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
//dataList = append(dataList, results...)
|
|
|
- var amountSum float64
|
|
|
for _, result := range results {
|
|
|
amountSum += result.Amount
|
|
|
fmt.Println("result.Amount:", result.Amount)
|
|
@@ -1081,25 +1076,25 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
}
|
|
|
amountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", amountSum), 64)
|
|
|
accumulate += amountTotal
|
|
|
-
|
|
|
- //var amountTotal float64
|
|
|
- results, e = fms.GetIncomeHistory(histortyCond, historyPars)
|
|
|
- if e != nil {
|
|
|
- resp.FailMsg("查询错误", fmt.Sprintf("获取汇总数据失败, Err: %s", e.Error()), c)
|
|
|
- return
|
|
|
- }
|
|
|
- //dataList = append(dataList, results...)
|
|
|
- for _, result := range results {
|
|
|
- amountSum += result.Amount
|
|
|
- if _, ok := groupInvoiceMap[result.SellerGroupId]; ok {
|
|
|
- groupInvoiceMap[result.SellerGroupId] += result.Amount
|
|
|
- } else {
|
|
|
- groupInvoiceMap[result.SellerGroupId] = result.Amount
|
|
|
- }
|
|
|
+ amountSum = 0
|
|
|
+ }
|
|
|
+ //var amountTotal float64
|
|
|
+ results, e := fms.GetIncomeHistory(histortyCond, historyPars)
|
|
|
+ if e != nil {
|
|
|
+ resp.FailMsg("查询错误", fmt.Sprintf("获取汇总数据失败, Err: %s", e.Error()), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //dataList = append(dataList, results...)
|
|
|
+ for _, result := range results {
|
|
|
+ amountSum += result.Amount
|
|
|
+ if _, ok := groupInvoiceMap[result.SellerGroupId]; ok {
|
|
|
+ groupInvoiceMap[result.SellerGroupId] += result.Amount
|
|
|
+ } else {
|
|
|
+ groupInvoiceMap[result.SellerGroupId] = result.Amount
|
|
|
}
|
|
|
- amountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", amountSum), 64)
|
|
|
- accumulate += amountTotal
|
|
|
}
|
|
|
+ amountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", amountSum), 64)
|
|
|
+ accumulate += amountTotal
|
|
|
} else if startDateTime.After(historyTime) || startDateTime.Equal(historyTime) {
|
|
|
//全部走新查询
|
|
|
//fmt.Println("新查询")
|
|
@@ -1194,6 +1189,7 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
|
|
|
// 开票到款金额合计(换算后)
|
|
|
var amountTotal float64
|
|
|
+ var amountSum float64
|
|
|
|
|
|
if len(summaryIds) > 0 {
|
|
|
amountCond := `a.id IN ? `
|
|
@@ -1215,7 +1211,6 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
//dataList = append(dataList, results...)
|
|
|
- var amountSum float64
|
|
|
for _, result := range results {
|
|
|
amountSum += result.Amount
|
|
|
fmt.Println("result.Amount:", result.Amount)
|
|
@@ -1227,30 +1222,30 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
}
|
|
|
amountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", amountSum), 64)
|
|
|
accumulate += amountTotal
|
|
|
-
|
|
|
+ amountSum = 0
|
|
|
//var amountTotal float64
|
|
|
// 旧查询
|
|
|
- if st != "" && ed != "" {
|
|
|
- histortyCond += ` AND (invoice_time BETWEEN ? AND ? )`
|
|
|
- historyPars = append(historyPars, st, ed)
|
|
|
- }
|
|
|
- results, e = fms.GetIncomeHistory(histortyCond, historyPars)
|
|
|
- if e != nil {
|
|
|
- resp.FailMsg("查询错误", fmt.Sprintf("获取汇总数据失败, Err: %s", e.Error()), c)
|
|
|
- return
|
|
|
- }
|
|
|
- //dataList = append(dataList, results...)
|
|
|
- for _, result := range results {
|
|
|
- amountSum += result.Amount
|
|
|
- if _, ok := groupInvoiceMap[result.SellerGroupId]; ok {
|
|
|
- groupInvoiceMap[result.SellerGroupId] += result.Amount
|
|
|
- } else {
|
|
|
- groupInvoiceMap[result.SellerGroupId] = result.Amount
|
|
|
- }
|
|
|
+ }
|
|
|
+ if st != "" && ed != "" {
|
|
|
+ histortyCond += ` AND (invoice_time BETWEEN ? AND ? )`
|
|
|
+ historyPars = append(historyPars, st, ed)
|
|
|
+ }
|
|
|
+ results, e := fms.GetIncomeHistory(histortyCond, historyPars)
|
|
|
+ if e != nil {
|
|
|
+ resp.FailMsg("查询错误", fmt.Sprintf("获取汇总数据失败, Err: %s", e.Error()), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //dataList = append(dataList, results...)
|
|
|
+ for _, result := range results {
|
|
|
+ amountSum += result.Amount
|
|
|
+ if _, ok := groupInvoiceMap[result.SellerGroupId]; ok {
|
|
|
+ groupInvoiceMap[result.SellerGroupId] += result.Amount
|
|
|
+ } else {
|
|
|
+ groupInvoiceMap[result.SellerGroupId] = result.Amount
|
|
|
}
|
|
|
- amountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", amountSum), 64)
|
|
|
- accumulate += amountTotal
|
|
|
}
|
|
|
+ amountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", amountSum), 64)
|
|
|
+ accumulate += amountTotal
|
|
|
}
|
|
|
|
|
|
fmt.Println("totalMoneySlice:", len(totalMoneySlice))
|