|
@@ -17,6 +17,7 @@ import (
|
|
|
"net/http"
|
|
|
"sort"
|
|
|
"strconv"
|
|
|
+ "strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -564,16 +565,16 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
amountPars = append(amountPars, groupIds)
|
|
|
}
|
|
|
|
|
|
- //if req.SellerIds != "" {
|
|
|
- // sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
- // amountCond += ` AND (( b.seller_id IN ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
- // amountCond += `OR ( d.seller_id IN ? AND a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)) `
|
|
|
- // amountPars = append(amountPars, sellerIds, st, ed, sellerIds, st, ed)
|
|
|
- //} else {
|
|
|
- // amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
- // amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
- // amountPars = append(amountPars, st, ed, st, ed)
|
|
|
- //}
|
|
|
+ if req.SellerIds != "" {
|
|
|
+ sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
+ amountCond += ` AND (( b.seller_id IN ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
+ amountCond += `OR ( d.seller_id IN ? AND a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)) `
|
|
|
+ amountPars = append(amountPars, sellerIds, st, ed, sellerIds, st, ed)
|
|
|
+ } else {
|
|
|
+ amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
+ amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
+ amountPars = append(amountPars, st, ed, st, ed)
|
|
|
+ }
|
|
|
results, e := fms.GetContractSummaryIncomeAmount(amountCond, amountPars)
|
|
|
if e != nil {
|
|
|
resp.FailMsg("查询错误", fmt.Sprintf("获取汇总数据失败, Err: %s", e.Error()), c)
|
|
@@ -648,16 +649,16 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
amountCond += ` AND IF ( a.invoice_id = 0, d.seller_group_id, b.seller_group_id ) IN (?) `
|
|
|
amountPars = append(amountPars, groupIds)
|
|
|
}
|
|
|
- //if req.SellerIds != "" {
|
|
|
- // sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
- // amountCond += ` AND (( b.seller_id IN ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
- // amountCond += `OR ( d.seller_id IN ? AND a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)) `
|
|
|
- // amountPars = append(amountPars, sellerIds, st, ed, sellerIds, st, ed)
|
|
|
- //} else {
|
|
|
- // amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
- // amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
- // amountPars = append(amountPars, st, ed, st, ed)
|
|
|
- //}
|
|
|
+ if req.SellerIds != "" {
|
|
|
+ sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
+ amountCond += ` AND (( b.seller_id IN ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
+ amountCond += `OR ( d.seller_id IN ? AND a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)) `
|
|
|
+ amountPars = append(amountPars, sellerIds, st, ed, sellerIds, st, ed)
|
|
|
+ } else {
|
|
|
+ amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
+ amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
+ amountPars = append(amountPars, st, ed, st, ed)
|
|
|
+ }
|
|
|
results, e := fms.GetContractSummaryIncomeAmount(amountCond, amountPars)
|
|
|
if e != nil {
|
|
|
resp.FailMsg("查询错误", fmt.Sprintf("获取汇总数据失败, Err: %s", e.Error()), c)
|
|
@@ -746,16 +747,16 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
|
|
|
amountCond += ` AND IF ( a.invoice_id = 0, d.seller_group_id, b.seller_group_id ) IN (?) `
|
|
|
amountPars = append(amountPars, groupIds)
|
|
|
}
|
|
|
- //if req.SellerIds != "" {
|
|
|
- // sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
- // amountCond += ` AND (( b.seller_id IN ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
- // amountCond += `OR ( d.seller_id IN ? AND a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)) `
|
|
|
- // amountPars = append(amountPars, sellerIds, st, ed, sellerIds, st, ed)
|
|
|
- //} else {
|
|
|
- // amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
- // amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
- // amountPars = append(amountPars, st, ed, st, ed)
|
|
|
- //}
|
|
|
+ if req.SellerIds != "" {
|
|
|
+ sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
+ amountCond += ` AND (( b.seller_id IN ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
+ amountCond += `OR ( d.seller_id IN ? AND a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)) `
|
|
|
+ amountPars = append(amountPars, sellerIds, st, ed, sellerIds, st, ed)
|
|
|
+ } else {
|
|
|
+ amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
+ amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
+ amountPars = append(amountPars, st, ed, st, ed)
|
|
|
+ }
|
|
|
results, e := fms.GetContractSummaryIncomeAmount(amountCond, amountPars)
|
|
|
if e != nil {
|
|
|
resp.FailMsg("查询错误", fmt.Sprintf("获取汇总数据失败, Err: %s", e.Error()), c)
|
|
@@ -1077,16 +1078,16 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
amountCond := `a.id IN ? `
|
|
|
amountPars := make([]interface{}, 0)
|
|
|
amountPars = append(amountPars, summaryIds)
|
|
|
- //if req.SellerIds != "" {
|
|
|
- // sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
- // amountCond += ` AND (( b.seller_id IN ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
- // amountCond += `OR ( d.seller_id IN ? AND a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)) `
|
|
|
- // amountPars = append(amountPars, sellerIds, st, ed, sellerIds, st, ed)
|
|
|
- //} else {
|
|
|
- // amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
- // amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
- // amountPars = append(amountPars, st, ed, st, ed)
|
|
|
- //}
|
|
|
+ if req.SellerIds != "" {
|
|
|
+ sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
+ amountCond += ` AND (( b.seller_id IN ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
+ amountCond += `OR ( d.seller_id IN ? AND a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)) `
|
|
|
+ amountPars = append(amountPars, sellerIds, st, ed, sellerIds, st, ed)
|
|
|
+ } else {
|
|
|
+ amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
+ amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
+ amountPars = append(amountPars, st, ed, st, ed)
|
|
|
+ }
|
|
|
results, e := fms.GetContractSummaryIncomeAmount(amountCond, amountPars)
|
|
|
if e != nil {
|
|
|
resp.FailMsg("查询错误", fmt.Sprintf("获取汇总数据失败, Err: %s", e.Error()), c)
|
|
@@ -1142,16 +1143,16 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
amountCond := `a.id IN ? `
|
|
|
amountPars := make([]interface{}, 0)
|
|
|
amountPars = append(amountPars, summaryIds)
|
|
|
- //if req.SellerIds != "" {
|
|
|
- // sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
- // amountCond += ` AND (( b.seller_id IN ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
- // amountCond += `OR ( d.seller_id IN ? AND a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)) `
|
|
|
- // amountPars = append(amountPars, sellerIds, st, ed, sellerIds, st, ed)
|
|
|
- //} else {
|
|
|
- // amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
- // amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
- // amountPars = append(amountPars, st, ed, st, ed)
|
|
|
- //}
|
|
|
+ if req.SellerIds != "" {
|
|
|
+ sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
+ amountCond += ` AND (( b.seller_id IN ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
+ amountCond += `OR ( d.seller_id IN ? AND a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)) `
|
|
|
+ amountPars = append(amountPars, sellerIds, st, ed, sellerIds, st, ed)
|
|
|
+ } else {
|
|
|
+ amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
+ amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
+ amountPars = append(amountPars, st, ed, st, ed)
|
|
|
+ }
|
|
|
results, e := fms.GetContractSummaryIncomeAmount(amountCond, amountPars)
|
|
|
if e != nil {
|
|
|
resp.FailMsg("查询错误", fmt.Sprintf("获取汇总数据失败, Err: %s", e.Error()), c)
|
|
@@ -1223,16 +1224,16 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
amountCond := `a.id IN ? `
|
|
|
amountPars := make([]interface{}, 0)
|
|
|
amountPars = append(amountPars, summaryIds)
|
|
|
- //if req.SellerIds != "" {
|
|
|
- // sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
- // amountCond += ` AND (( b.seller_id IN ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
- // amountCond += `OR ( d.seller_id IN ? AND a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)) `
|
|
|
- // amountPars = append(amountPars, sellerIds, st, ed, sellerIds, st, ed)
|
|
|
- //} else {
|
|
|
- // amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
- // amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
- // amountPars = append(amountPars, st, ed, st, ed)
|
|
|
- //}
|
|
|
+ if req.SellerIds != "" {
|
|
|
+ sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
+ amountCond += ` AND (( b.seller_id IN ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
+ amountCond += `OR ( d.seller_id IN ? AND a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)) `
|
|
|
+ amountPars = append(amountPars, sellerIds, st, ed, sellerIds, st, ed)
|
|
|
+ } else {
|
|
|
+ amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
+ amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
+ amountPars = append(amountPars, st, ed, st, ed)
|
|
|
+ }
|
|
|
results, e := fms.GetContractSummaryIncomeAmount(amountCond, amountPars)
|
|
|
if e != nil {
|
|
|
resp.FailMsg("查询错误", fmt.Sprintf("获取汇总数据失败, Err: %s", e.Error()), c)
|