ziwen 1 year ago
parent
commit
6949a36de9
2 changed files with 15 additions and 42 deletions
  1. 13 41
      controller/census/invoice_payment.go
  2. 2 1
      models/fms/contract_invoice.go

+ 13 - 41
controller/census/invoice_payment.go

@@ -415,7 +415,6 @@ func ExportInvoicePaymentCensusList(c *gin.Context, results *fms.InvoicePaymentC
 	}
 
 	newCompanyMap := map[int]string{0: "/", 1: "是", 2: "否"}
-	sellerTypeMap := map[int]string{1: "FICC销售", 2: "权益销售"}
 	for k, v := range list {
 		dataRow := sheet.AddRow()
 		// 前四个单元格根据每行开票到款条数向下合并
@@ -448,7 +447,7 @@ func ExportInvoicePaymentCensusList(c *gin.Context, results *fms.InvoicePaymentC
 				fms.ContractPaymentPayTypeNameMap[v2.PayType], // 付款方式
 				v2.SellerName,                                 // 销售
 				v2.SellerGroupName,                            // 组别
-				sellerTypeMap[v2.SellerType],                  // 销售类型
+				v2.SellerType,                  // 销售类型
 			}
 			// 套餐金额信息
 			serviceTempShowAmount := make(map[int]string)
@@ -760,7 +759,16 @@ func (ct *InvoicePaymentController) List(c *gin.Context) {
 					serviceAmountMap[serviceAmountList[i].ContractPaymentId] = append(serviceAmountMap[serviceAmountList[i].ContractPaymentId], serviceAmountList[i])
 				}
 			}
-
+			sellerTypeMap := map[int]string{2: "FICC销售", 5: "权益销售"}
+			sellerList, e := crmService.GetSellerDepartmentListWithGroupAndTeam()
+			if e != nil {
+				resp.FailData("获取销售失败", "Err:"+e.Error(), c)
+				return
+			}
+			sellerMap := make(map[int]*crm.SellerAdminWithGroupTeam)
+			for i := range sellerList {
+				sellerMap[sellerList[i].SellerId] = sellerList[i]
+			}
 			// 重组汇总数据
 			summaryMap := make(map[int][]*fms.InvoicePaymentCensusInfo)
 			amountMap := make(map[string]*fms.ContractPaymentServiceAmount)
@@ -773,7 +781,7 @@ func (ct *InvoicePaymentController) List(c *gin.Context) {
 				v.SellerName = summaryList[i].SellerName
 				v.SellerGroupId = summaryList[i].SellerGroupId
 				v.SellerGroupName = summaryList[i].SellerGroupName
-				v.SellerType = summaryList[i].ServiceProductId
+				v.SellerType = sellerTypeMap[sellerMap[summaryList[i].SellerId].DepartmentId]
 				v.PaymentId = summaryList[i].PaymentId
 				v.PaymentDate = utils.TimeTransferString(utils.FormatDate, summaryList[i].PaymentDate)
 				v.PaymentAmount = summaryList[i].PaymentAmount
@@ -2105,43 +2113,6 @@ func (ct *InvoicePaymentController) NotPaymentList(c *gin.Context) {
 		cond += ` AND a.service_product_id = 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)
-	//	}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)
-	//	}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)
@@ -2271,6 +2242,7 @@ func (ct *InvoicePaymentController) NotPaymentList(c *gin.Context) {
 				v.PaymentAmount = summaryList[i].PaymentAmount
 				v.PayType = summaryList[i].PayType
 				v.NotPaymentAmount = summaryList[i].InvoiceAmount - summaryList[i].PaymentAmount
+				v.ServiceProductId =  summaryList[i].ServiceProductId
 
 				summaryMap[summaryList[i].SummaryId] = append(summaryMap[summaryList[i].SummaryId], v)
 			}

+ 2 - 1
models/fms/contract_invoice.go

@@ -369,7 +369,7 @@ type InvoicePaymentCensusInfo struct {
 	PaymentAmount     float64                             `json:"payment_amount" description:"到款金额"`
 	PayType           int                                 `json:"pay_type" description:"付款方式:0-无;1-年付;2-半年付;3-季付;4-次付;5-异常"`
 	ServiceAmountList []*ContractPaymentServiceAmountItem `json:"service_amount_list" description:"到款套餐金额分配信息"`
-	SellerType        int                                 `json:"seller_type" description:"销售类型:1ficc销售,2权益销售"`
+	SellerType        string                               `json:"seller_type" description:"销售类型:1ficc销售,2权益销售"`
 }
 
 // ContractInvoiceAmountTotal 开票到款金额合计信息
@@ -706,6 +706,7 @@ type NotPaymentCensusInfo struct {
 	ServiceAmountList []*ContractPaymentServiceAmountItem `json:"service_amount_list" description:"到款套餐金额分配信息"`
 	SellerType        int                                 `json:"seller_type" description:"销售类型:1ficc销售,2权益销售"`
 	NotPaymentAmount  float64                             `json:"not_payment_amount" description:"开票未到款金额"`
+	ServiceProductId int       `json:"service_product_id" description:"套餐类型:1ficc套餐,2权益套餐"`
 }