123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850 |
- package census
- import (
- "bytes"
- "fmt"
- "github.com/gin-gonic/gin"
- "github.com/go-playground/validator/v10"
- "github.com/tealeg/xlsx"
- "hongze/fms_api/controller/resp"
- "hongze/fms_api/global"
- "hongze/fms_api/models/base"
- "hongze/fms_api/models/fms"
- "hongze/fms_api/utils"
- "net/http"
- "strconv"
- "strings"
- "sync"
- "time"
- )
- type InvoicePaymentController struct{}
- func ExportInvoicePaymentCensusList(c *gin.Context, results *fms.InvoicePaymentCensusResp) {
- list := results.DataList
- if len(list) == 0 {
- resp.Fail("列表数据为空", c)
- return
- }
-
- xlsxFile := xlsx.NewFile()
- style := xlsx.NewStyle()
- alignment := xlsx.Alignment{
- Horizontal: "center",
- Vertical: "center",
- WrapText: true,
- }
- style.Alignment = alignment
- style.ApplyAlignment = true
- sheet, err := xlsxFile.AddSheet("商品到款统计")
- if err != nil {
- resp.FailData("新增Sheet失败", "Err:"+err.Error(), c)
- return
- }
- _ = sheet.SetColWidth(1, 1, 30)
- _ = sheet.SetColWidth(3, 3, 30)
-
- rowA := sheet.AddRow()
- cellAA := rowA.AddCell()
- cellAA.SetString(fmt.Sprintf("已开票合计金额(换算后):%.2f(元)", results.InvoiceTotal))
- rowBData := "已开票金额:"
- for _, v := range results.InvoiceCurrencyTotal {
- rowBData += fmt.Sprintf("%s%.2f(%s) ", v.Name, v.Amount, v.UnitName)
- }
- rowB := sheet.AddRow()
- rowB.AddCell().SetString(rowBData)
- sheet.AddRow()
-
- rowD := sheet.AddRow()
- cellDA := rowD.AddCell()
- cellDA.SetString(fmt.Sprintf("已到款合计金额(换算后):%.2f(元)", results.PaymentTotal))
- rowEData := "已到款金额:"
- for _, v := range results.PaymentCurrencyTotal {
- rowEData += fmt.Sprintf("%s%.2f(%s) ", v.Name, v.Amount, v.UnitName)
- }
- rowE := sheet.AddRow()
- rowE.AddCell().SetString(rowEData)
- sheet.AddRow()
-
- rowTitle := []string{"序号", "客户名称", "是否新客户", "合同有效期", "开票日", "开票金额", "到款日", "到款金额", "付款方式", "销售",
- "组别"}
- serviceTempCond := ``
- serviceTempPars := make([]interface{}, 0)
- serviceTempOB := new(fms.ContractServiceTemplate)
- serviceTempList, e := serviceTempOB.List(serviceTempCond, serviceTempPars)
- if e != nil {
- resp.FailData("获取套餐模板列表失败", "Err:"+e.Error(), c)
- return
- }
- for i := range serviceTempList {
- rowTitle = append(rowTitle, serviceTempList[i].Title)
- }
- titleRow := sheet.AddRow()
- for i := range rowTitle {
- v := titleRow.AddCell()
- v.SetString(rowTitle[i])
- v.SetStyle(style)
- }
- newCompanyMap := map[int]string{0: "否", 1: "是"}
- for k, v := range list {
- dataRow := sheet.AddRow()
-
- l := len(v.InvoicePaymentList)
- mergeRowNum := l - 1
-
- sortNum := k + 1
- colA := dataRow.AddCell()
- colA.VMerge = mergeRowNum
- colA.SetString(fmt.Sprint(sortNum))
-
- colB := dataRow.AddCell()
- colB.VMerge = mergeRowNum
- colB.SetString(v.CompanyName)
-
- colC := dataRow.AddCell()
- colC.VMerge = mergeRowNum
- colC.SetString(newCompanyMap[v.NewCompany])
-
- colD := dataRow.AddCell()
- colD.VMerge = mergeRowNum
- colD.SetString(fmt.Sprint(v.StartDate, "至", v.EndDate))
-
- for k2, v2 := range v.InvoicePaymentList {
- rowData := []string{
- v2.InvoiceDate,
- fmt.Sprint(v2.InvoiceAmount),
- v2.PaymentDate,
- fmt.Sprint(v2.PaymentAmount),
- fms.ContractPaymentPayTypeNameMap[v2.PayType],
- v2.SellerName,
- v2.SellerGroupName,
- }
-
- for i := range serviceTempList {
- sa := ""
- for s2 := range v2.ServiceAmountList {
- if v2.ServiceAmountList[s2].ServiceTemplateId == serviceTempList[i].ServiceTemplateId {
- sa = fmt.Sprint(v2.ServiceAmountList[s2].Amount)
- break
- }
- }
- rowData = append(rowData, sa)
- }
-
- if k2 == 0 {
- for i := range rowData {
- dataRow.AddCell().SetString(rowData[i])
- }
- continue
- }
-
- dataRowExtra := sheet.AddRow()
- for i := 0; i < 4; i++ {
- dataRowExtra.AddCell()
- }
- for i := range rowData {
- dataRowExtra.AddCell().SetString(rowData[i])
- }
- }
- }
-
- var buffer bytes.Buffer
- _ = xlsxFile.Write(&buffer)
- content := bytes.NewReader(buffer.Bytes())
- randStr := time.Now().Format(utils.FormatDateTimeUnSpace)
- fileName := "商品到款统计_" + randStr + ".xlsx"
- c.Writer.Header().Add("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"`, fileName))
- c.Writer.Header().Add("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
- http.ServeContent(c.Writer, c.Request, fileName, time.Now(), content)
- }
- func (ct *InvoicePaymentController) List(c *gin.Context) {
- var req fms.InvoicePaymentCensusListReq
- if e := c.BindQuery(&req); e != nil {
- err, ok := e.(validator.ValidationErrors)
- if !ok {
- resp.FailData("参数解析失败", "Err:"+e.Error(), c)
- return
- }
- resp.FailData("参数解析失败", err.Translate(global.Trans), c)
- return
- }
- cond := `1 = 1`
- pars := make([]interface{}, 0)
-
- if req.Keyword != "" {
- kw := "%" + req.Keyword + "%"
- cond += ` AND b.company_name LIKE ? OR c.seller_name LIKE ?`
- pars = append(pars, kw, kw)
- }
- if req.SellGroupId > 0 {
- cond += ` AND c.seller_group_id = ?`
- pars = append(pars, req.SellGroupId)
- }
-
- if req.ServiceType != 0 {
- tempRegisterIds, e := fms.GetContractRegisterIdsByTempId(req.ServiceType)
- if e != nil {
- resp.FailMsg("获取失败", "获取合同登记IDs失败, Err: "+e.Error(), c)
- return
- }
- if len(tempRegisterIds) > 0 {
- cond += ` AND a.register_id IN ?`
- pars = append(pars, tempRegisterIds)
- } else {
- cond += ` AND 1 = 2`
- }
- }
-
- if req.TimeType != 0 {
- if req.TimeType == 1 && req.StartDate != "" && req.EndDate != "" {
- st := fmt.Sprint(req.StartDate, " 00:00:00")
- ed := fmt.Sprint(req.EndDate, " 23:59:59")
- cond += ` AND (c.invoice_time BETWEEN ? AND ?) `
- pars = append(pars, st, ed, st, ed)
- }else if req.TimeType == 2 && req.StartDate != "" && req.EndDate != "" {
- st := fmt.Sprint(req.StartDate, " 00:00:00")
- ed := fmt.Sprint(req.EndDate, " 23:59:59")
- cond += ` AND (d.invoice_time BETWEEN ? AND ?) `
- pars = append(pars, st, ed, st, ed)
- }else if req.TimeType == 3 && req.StartDate != "" && req.EndDate != "" {
- st := fmt.Sprint(req.StartDate, " 00:00:00")
- ed := fmt.Sprint(req.EndDate, " 23:59:59")
- cond += ` AND (c.invoice_time BETWEEN ? AND ?) AND (d.invoice_time BETWEEN ? AND ?) `
- pars = append(pars, st, ed, st, ed)
- }
- }else if req.StartDate != "" && req.EndDate != "" {
- st := fmt.Sprint(req.StartDate, " 00:00:00")
- ed := fmt.Sprint(req.EndDate, " 23:59:59")
- cond += ` AND ((c.invoice_time BETWEEN ? AND ?) or (d.invoice_time BETWEEN ? AND ?))`
- pars = append(pars, st, ed, st, ed)
- }
- if req.HasInvoice == "1" {
- cond += ` AND a.invoice_id > 0 `
- }else if req.HasInvoice == "0" {
- cond += ` AND a.invoice_id = 0 `
- }
- if req.HasPayment == "1" {
- cond += ` AND a.payment_id > 0 `
- }else if req.HasPayment == "0" {
- cond += ` AND a.payment_id = 0 `
- }
- page := new(base.Page)
- page.SetPageSize(req.PageSize)
- page.SetCurrent(req.Current)
-
- if req.SortType == "" {
- req.SortType = "desc"
- }
- if req.SortType != "desc" && req.SortType != "asc" {
- resp.Fail("排序类型不正确", c)
- return
- }
- if req.SortParam == "" {
- page.AddOrderItem(base.OrderItem{Column: "sort_invoice_id", Asc: true})
- page.AddOrderItem(base.OrderItem{Column: "sort_payment_id", Asc: false})
- page.AddOrderItem(base.OrderItem{Column: "c.invoice_time", Asc: false})
- page.AddOrderItem(base.OrderItem{Column: "c.amount", Asc: false})
- page.AddOrderItem(base.OrderItem{Column: "a.create_time", Asc: false})
- }else if req.SortParam == "invoice_time" {
- if req.SortType == "asc" {
- page.AddOrderItem(base.OrderItem{Column: "sort_invoice_id", Asc: false})
- page.AddOrderItem(base.OrderItem{Column: "c.invoice_time", Asc: true})
- page.AddOrderItem(base.OrderItem{Column: "c.amount", Asc: true})
- page.AddOrderItem(base.OrderItem{Column: "a.create_time", Asc: true})
- }else{
- page.AddOrderItem(base.OrderItem{Column: "sort_invoice_id", Asc: true})
- page.AddOrderItem(base.OrderItem{Column: "c.invoice_time", Asc: false})
- page.AddOrderItem(base.OrderItem{Column: "c.amount", Asc: false})
- page.AddOrderItem(base.OrderItem{Column: "a.create_time", Asc: false})
- }
- }else if req.SortParam == "payment_date" {
- if req.SortType == "asc" {
- page.AddOrderItem(base.OrderItem{Column: "sort_payment_id", Asc: false})
- page.AddOrderItem(base.OrderItem{Column: "d.invoice_time", Asc: true})
- page.AddOrderItem(base.OrderItem{Column: "d.amount", Asc: true})
- page.AddOrderItem(base.OrderItem{Column: "a.create_time", Asc: true})
- }else{
- page.AddOrderItem(base.OrderItem{Column: "sort_payment_id", Asc: true})
- page.AddOrderItem(base.OrderItem{Column: "d.invoice_time", Asc: false})
- page.AddOrderItem(base.OrderItem{Column: "d.amount", Asc: false})
- page.AddOrderItem(base.OrderItem{Column: "a.create_time", Asc: false})
- }
- }else{
- resp.Fail("排序字段不正确", c)
- return
- }
- if req.IsExport == 1 {
- page.SetPageSize(10000)
- page.SetCurrent(1)
- }
- registerList, total, e := fms.GetInvoicePaymentCensusPageList(page, cond, pars)
- if e != nil {
- resp.FailMsg("获取失败", "获取商品到款统计列表总数失败, Err: "+e.Error(), c)
- return
- }
- queryRegisterIds := make([]int, 0)
- for i := range registerList {
- queryRegisterIds = append(queryRegisterIds, registerList[i].ContractRegisterId)
- }
- results := new(fms.InvoicePaymentCensusResp)
- if len(queryRegisterIds) > 0 {
-
- summaryIdsCond := cond
- summaryIdsPars := pars
- summaryIds, e := fms.GetInvoicePaymentCensusSummaryDataIds(summaryIdsCond, summaryIdsPars)
- if e != nil {
- resp.FailMsg("获取失败", "获取商品到款汇总IDs失败, Err: "+e.Error(), c)
- return
- }
- var listErr, totalErr, totalGroupErr error
- wg := sync.WaitGroup{}
-
- respList := make([]*fms.InvoicePaymentCensusItem, 0)
- summaryList := make([]*fms.InvoicePaymentSummaryItem, 0)
- wg.Add(1)
- go func() {
- defer wg.Done()
-
- summaryCond := cond
- summaryCond += ` AND a.register_id IN ?`
- summaryPars := pars
- summaryPars = append(summaryPars, queryRegisterIds)
- summaryData, e := fms.GetInvoicePaymentCensusSummaryData(summaryCond, summaryPars)
- if e != nil {
- resp.FailMsg("获取失败", "获取商品到款汇总列表失败, Err: "+e.Error(), c)
- return
- }
- summaryList = summaryData
-
- paymentIds := make([]int, 0)
- for i := range summaryList {
-
- if summaryList[i].PaymentId > 0 {
- paymentIds = append(paymentIds, summaryList[i].PaymentId)
- }
- }
-
- contractServiceCond := `contract_register_id IN ?`
- contractServicePars := make([]interface{}, 0)
- contractServicePars = append(contractServicePars, queryRegisterIds)
- contractServiceOB := new(fms.ContractService)
- contractServiceList, e := contractServiceOB.List(contractServiceCond, contractServicePars)
- if e != nil {
- listErr = fmt.Errorf("获取合同套餐列表失败, Err: %s", e.Error())
- return
- }
- contractServiceMap := make(map[int][]*fms.ContractService, 0)
- servicesNameMap := make(map[int][]string, 0)
- for i := range contractServiceList {
- if contractServiceMap[contractServiceList[i].ContractRegisterId] == nil {
- contractServiceMap[contractServiceList[i].ContractRegisterId] = make([]*fms.ContractService, 0)
- }
- contractServiceMap[contractServiceList[i].ContractRegisterId] = append(contractServiceMap[contractServiceList[i].ContractRegisterId], contractServiceList[i])
- servicesNameMap[contractServiceList[i].ContractRegisterId] = append(servicesNameMap[contractServiceList[i].ContractRegisterId], contractServiceList[i].Title)
- }
-
- serviceAmountMap := make(map[int][]*fms.ContractPaymentServiceAmount, 0)
- if len(paymentIds) > 0 {
- serviceAmountCond := `contract_payment_id IN ?`
- serviceAmountPars := make([]interface{}, 0)
- serviceAmountPars = append(serviceAmountPars, paymentIds)
- serviceAmountOB := new(fms.ContractPaymentServiceAmount)
- serviceAmountList, e := serviceAmountOB.List(serviceAmountCond, serviceAmountPars)
- if e != nil {
- listErr = fmt.Errorf("获取到款套餐分配列表失败, Err: %s", e.Error())
- return
- }
- for i := range serviceAmountList {
- if serviceAmountMap[serviceAmountList[i].ContractPaymentId] == nil {
- serviceAmountMap[serviceAmountList[i].ContractPaymentId] = make([]*fms.ContractPaymentServiceAmount, 0)
- }
- serviceAmountMap[serviceAmountList[i].ContractPaymentId] = append(serviceAmountMap[serviceAmountList[i].ContractPaymentId], serviceAmountList[i])
- }
- }
-
- summaryMap := make(map[int][]*fms.InvoicePaymentCensusInfo)
- amountMap := make(map[string]*fms.ContractPaymentServiceAmount)
- for i := range summaryList {
- v := new(fms.InvoicePaymentCensusInfo)
- v.InvoiceId = summaryList[i].InvoiceId
- v.InvoiceDate = utils.TimeTransferString(utils.FormatDate, summaryList[i].InvoiceDate)
- v.InvoiceAmount = summaryList[i].InvoiceAmount
- v.SellerId = summaryList[i].SellerId
- v.SellerName = summaryList[i].SellerName
- v.SellerGroupId = summaryList[i].SellerGroupId
- v.SellerGroupName = summaryList[i].SellerGroupName
- v.PaymentId = summaryList[i].PaymentId
- v.PaymentDate = utils.TimeTransferString(utils.FormatDate, summaryList[i].PaymentDate)
- v.PaymentAmount = summaryList[i].PaymentAmount
- v.PayType = summaryList[i].PayType
-
- svaList := make([]*fms.ContractPaymentServiceAmountItem, 0)
- amountList := serviceAmountMap[summaryList[i].PaymentId]
- if amountList != nil {
- for i := range amountList {
- k := fmt.Sprintf("%d-%d", amountList[i].ContractPaymentId, amountList[i].ServiceTemplateId)
- amountMap[k] = amountList[i]
- }
- }
-
- svList := contractServiceMap[summaryList[i].RegisterId]
- if svList != nil {
- for ii := range svList {
- vv := new(fms.ContractPaymentServiceAmountItem)
- vv.ServiceTemplateId = svList[ii].ServiceTemplateId
- vv.ServiceTemplateName = svList[ii].Title
- k2 := fmt.Sprintf("%d-%d", summaryList[i].PaymentId, svList[ii].ServiceTemplateId)
- a := amountMap[k2]
- if a != nil {
- vv.ContractPaymentServiceAmountId = a.ContractPaymentServiceAmountId
- vv.ContractPaymentId = a.ContractPaymentId
- vv.Amount = a.Amount
- }
- svaList = append(svaList, vv)
- }
- }
- v.ServiceAmountList = svaList
- summaryMap[summaryList[i].SummaryId] = append(summaryMap[summaryList[i].SummaryId], v)
- }
-
- for i := range registerList {
- v := new(fms.InvoicePaymentCensusItem)
- v.SummaryId = registerList[i].SummaryId
- v.ContractRegisterId = registerList[i].ContractRegisterId
- v.CompanyName = registerList[i].CompanyName
- v.NewCompany = registerList[i].NewCompany
- v.StartDate = utils.TimeTransferString(utils.FormatDate, registerList[i].StartDate)
- v.EndDate = utils.TimeTransferString(utils.FormatDate, registerList[i].EndDate)
- svList := servicesNameMap[registerList[i].ContractRegisterId]
- v.ServicesName = strings.Join(svList, ",")
- v.InvoicePaymentList = summaryMap[registerList[i].SummaryId]
- respList = append(respList, v)
- }
- }()
-
- var invoiceTotal, paymentTotal float64
- wg.Add(1)
- go func() {
- defer wg.Done()
- if len(summaryIds) == 0 {
- return
- }
- amountTotalCond := `a.id IN ?`
- amountTotalPars := make([]interface{}, 0)
- amountTotalPars = append(amountTotalPars, summaryIds)
- invoiceSum, e := fms.GetContractSummaryInvoicePaymentAmountTotal(amountTotalCond, amountTotalPars, 1)
- if e != nil {
- totalErr = fmt.Errorf("获取汇总开票金额合计失败, Err: %s", e.Error())
- return
- }
- invoiceTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", invoiceSum), 64)
- paymentSum, e := fms.GetContractSummaryInvoicePaymentAmountTotal(amountTotalCond, amountTotalPars, 2)
- if e != nil {
- totalErr = fmt.Errorf("获取汇总到款金额合计失败, Err: %s", e.Error())
- return
- }
- paymentTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", paymentSum), 64)
- }()
-
- invoiceCurrencyTotals := make([]*fms.InvoiceListCurrencyTotal, 0)
- paymentCurrencyTotals := make([]*fms.InvoiceListCurrencyTotal, 0)
- wg.Add(1)
- go func() {
- defer wg.Done()
- currencyOB := new(fms.CurrencyUnit)
- currencyCond := `enable = 1`
- currencyPars := make([]interface{}, 0)
- currencyList, e := currencyOB.List(currencyCond, currencyPars)
- if e != nil {
- totalGroupErr = fmt.Errorf("获取货币列表失败, Err: %s", e.Error())
- return
- }
- unitMap := make(map[string]string)
- for i := range currencyList {
- unitMap[currencyList[i].Code] = currencyList[i].UnitName
- invoiceCurrencyTotals = append(invoiceCurrencyTotals, &fms.InvoiceListCurrencyTotal{
- Name: currencyList[i].Name,
- UnitName: currencyList[i].UnitName,
- Code: currencyList[i].Code,
- FlagImg: currencyList[i].FlagImg,
- })
- paymentCurrencyTotals = append(paymentCurrencyTotals, &fms.InvoiceListCurrencyTotal{
- Name: currencyList[i].Name,
- UnitName: currencyList[i].UnitName,
- Code: currencyList[i].Code,
- FlagImg: currencyList[i].FlagImg,
- })
- }
- if len(summaryIds) == 0 {
- return
- }
- totalGroupCond := `a.id IN ?`
- totalGroupPars := make([]interface{}, 0)
- totalGroupPars = append(totalGroupPars, summaryIds)
- invoiceSumGroup, e := fms.GetSummaryListCurrencySum(totalGroupCond, totalGroupPars, 1)
- if e != nil {
- totalGroupErr = fmt.Errorf("获取汇总货币合计开票金额失败, Err: %s", e.Error())
- return
- }
- paymentSumGroup, e := fms.GetSummaryListCurrencySum(totalGroupCond, totalGroupPars, 2)
- if e != nil {
- totalGroupErr = fmt.Errorf("获取汇总货币合计到款金额失败, Err: %s", e.Error())
- return
- }
- invoiceSumMap := make(map[string]float64)
- paymentSumMap := make(map[string]float64)
- for i := range invoiceSumGroup {
- invoiceSumMap[invoiceSumGroup[i].CurrencyUnit] = invoiceSumGroup[i].OriginAmountTotal
- continue
- }
- for i := range paymentSumGroup {
- paymentSumMap[paymentSumGroup[i].CurrencyUnit] = paymentSumGroup[i].OriginAmountTotal
- continue
- }
- for i := range invoiceCurrencyTotals {
- a, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", invoiceSumMap[invoiceCurrencyTotals[i].Code]), 64)
- invoiceCurrencyTotals[i].Amount = a
- }
- for i := range paymentCurrencyTotals {
- a, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", paymentSumMap[paymentCurrencyTotals[i].Code]), 64)
- paymentCurrencyTotals[i].Amount = a
- }
- }()
- wg.Wait()
- if listErr != nil {
- resp.FailMsg("获取失败", listErr.Error(), c)
- return
- }
- if totalErr != nil {
- resp.FailMsg("获取失败", totalErr.Error(), c)
- return
- }
- if totalGroupErr != nil {
- resp.FailMsg("获取失败", totalGroupErr.Error(), c)
- return
- }
- results.DataList = respList
- results.InvoiceTotal = invoiceTotal
- results.PaymentTotal = paymentTotal
- results.InvoiceCurrencyTotal = invoiceCurrencyTotals
- results.PaymentCurrencyTotal = paymentCurrencyTotals
- }
-
- if req.IsExport == 1 {
- ExportInvoicePaymentCensusList(c, results)
- return
- }
- page.SetTotal(total)
- baseData := new(base.BaseData)
- baseData.SetPage(page)
- baseData.SetList(results)
- resp.OkData("获取成功", baseData, c)
- }
|