zwxi 1 년 전
부모
커밋
b4d75ccd2b
1개의 변경된 파일34개의 추가작업 그리고 49개의 파일을 삭제
  1. 34 49
      controller/census/invoice_payment.go

+ 34 - 49
controller/census/invoice_payment.go

@@ -1463,7 +1463,6 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 	fmt.Println("prevTotalMoneySlice:", len(prevTotalMoneySlice))
 	fmt.Println("totalMoneySlice:", len(totalMoneySlice))
 
-
 	if req.CompanyType != 3 {
 		//计算同比值
 		for i := range prevTotalMoneySlice {
@@ -1490,37 +1489,22 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 		// 当筛选条件是”季度“、”半年度“、”年度“、”月度统计“时,并且客户是”未续约“时,仅展示柱形图,无曲线图
 		// 未续约客户收入:去年同期老客户收入金额  减  当期老客户收入金额
 		// 移动平均值:若是10月份,计算8月,9月,10月,这三个月的收入金额平均值
-		if req.ListParam == "0" {
-			for i := range prevTotalMoneySlice {
-				totalMoneySlice[i], _ = strconv.ParseFloat(fmt.Sprintf("%.2f", prevTotalMoneySlice[i] - totalMoneySlice[i] ), 64)
-				var yoy float64
-				var yoyStr string
-				if i > 1 {
-					// 前俩月没有
-					//fmt.Println("1:", prevTotalMoneySlice[i])
-					//fmt.Println("2:", totalMoneySlice[i])
-					//fmt.Println("3:", totalMoneySlice[i]-prevTotalMoneySlice[i])
-					//if prevTotalMoneySlice[i] != 0 && totalMoneySlice[i] != 0 {
-					//	yoy = (totalMoneySlice[i] - prevTotalMoneySlice[i]) / prevTotalMoneySlice[i]
-					//	yoyStr = fmt.Sprintf("%.4f", yoy)
-					//
-					//	if i == len(prevTotalMoneySlice)-1 && i > 0 && req.ListParam == "3" {
-					//		fmt.Println("totalMoneySlice[i-1]:", totalMoneySlice[i-1])
-					//		yoy = (totalMoneySlice[i] - totalMoneySlice[i-1]) / totalMoneySlice[i-1]
-					//		yoyStr = fmt.Sprintf("%.4f", yoy)
-					//	}
-					//}
-					yoy = (totalMoneySlice[i] + totalMoneySlice[i-1] + totalMoneySlice[i-2]) / 3
-					yoyStr = fmt.Sprintf("%.4f", yoy)
-					yoySlice = append(yoySlice, yoyStr)
-				} else {
-					yoySlice = append(yoySlice, "")
-				}
+		for i := range prevTotalMoneySlice {
+			totalMoneySlice[i], _ = strconv.ParseFloat(fmt.Sprintf("%.2f", prevTotalMoneySlice[i]-totalMoneySlice[i]), 64)
+
+			var yoy float64
+			var yoyStr string
+			if i > 1 && req.ListParam == "0" {
+				// 前俩月没有
+				yoy = (totalMoneySlice[i] + totalMoneySlice[i-1] + totalMoneySlice[i-2]) / 3
+				yoyStr = fmt.Sprintf("%.4f", yoy)
+				yoySlice = append(yoySlice, yoyStr)
+			} else {
+				yoySlice = append(yoySlice, "")
 			}
 		}
 	}
 
-
 	incomeChart.Title = "开票到款统计图"
 	incomeChart.Date = dateSlice
 	incomeChart.TotalMoney = totalMoneySlice
@@ -1676,7 +1660,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 	page := new(base.Page)
 	page.SetPageSize(req.PageSize)
 	page.SetCurrent(req.Current)
-	//排序
+	// 排序
 	if req.SortType == "" {
 		req.SortType = "asc"
 	}
@@ -1708,7 +1692,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 		page.SetCurrent(1)
 	}
 
-	//先拿到在筛选范围内的合同列表
+	// 先拿到在筛选范围内的合同列表
 	cond += `  AND b.contract_amount <> b.invoiced_amount AND b.is_deleted = 0 AND b.contract_amount <> b.payment_amount AND b.contract_status <> 4 `
 	registerList, total, e := fms.GetInvoiceCensusPageList(page, cond, pars)
 	if e != nil {
@@ -1771,7 +1755,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 			// 有开票到款过的记录map,用于在后面判断是否有过开票到款,然后补充数据
 			NotInvoiceSummaryMap := make(map[int][]*fms.NotInvoicePaymentSummaryItem, 0)
 			for _, v := range summaryList {
-				//fmt.Println("v2.ContractRegisterId", v.ContractRegisterId)
+				// fmt.Println("v2.ContractRegisterId", v.ContractRegisterId)
 				NotInvoiceSummaryMap[v.RegisterId] = append(NotInvoiceSummaryMap[v.RegisterId], v)
 			}
 
@@ -1791,17 +1775,17 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 			}
 			//fmt.Println("len(noSummaryData)", len(noSummaryData))
 
-			//补充为完整的list,包含有汇总记录的和没有汇总记录的
+			// 补充为完整的list,包含有汇总记录的和没有汇总记录的
 			summaryList = append(summaryList, noSummaryData...)
 
 			//fmt.Println("len(NotInvoiceSummaryMap):", len(NotInvoiceSummaryMap))
 
-			//遍历列表,补充数据
+			// 遍历列表,补充数据
 			for _, v := range summaryList {
-				//fmt.Println("ProductIds:", v.ProductIds)
-				//fmt.Println("ContractRegisterId:", v.ContractRegisterId)
-				//fmt.Println("ServiceProductId:", v.ServiceProductId)
-				//fmt.Println("RegisterId:", v.RegisterId)
+				// fmt.Println("ProductIds:", v.ProductIds)
+				// fmt.Println("ContractRegisterId:", v.ContractRegisterId)
+				// fmt.Println("ServiceProductId:", v.ServiceProductId)
+				// fmt.Println("RegisterId:", v.RegisterId)
 				fmt.Println("len(NotInvoiceSummaryMap[v.RegisterId]):", len(NotInvoiceSummaryMap[v.ContractRegisterId]))
 				if (v.ProductIds == "1,2" || v.ProductIds == "2,1") && len(NotInvoiceSummaryMap[v.ContractRegisterId]) == 1 {
 					// 套餐是ficc权益都有的,但是只有一个套餐有过开票到款,手动补充另一个套餐的信息
@@ -1915,10 +1899,10 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 
 			for registerId, list := range NotInvoiceSummaryMap {
 				for _, v := range list {
-					//fmt.Println("v.ContractRegisterId", v.ContractRegisterId)
-					//fmt.Println("v.ServiceProductId:", v.ServiceProductId)
-					//fmt.Println("v.NotInvoicedAmountTotal:", v.NotInvoicedAmountTotal)
-					//fmt.Println("registerId:",registerId)
+					// fmt.Println("v.ContractRegisterId", v.ContractRegisterId)
+					// fmt.Println("v.ServiceProductId:", v.ServiceProductId)
+					// fmt.Println("v.NotInvoicedAmountTotal:", v.NotInvoicedAmountTotal)
+					// fmt.Println("registerId:",registerId)
 					if v.NotInvoicedAmountTotal == 0 {
 						if v.InvoiceAmountTotal > v.PaymentAmountTotal {
 							// 有合规登记或补录合同过的,有serviceAmountMap信息
@@ -2201,7 +2185,7 @@ func (ct *InvoicePaymentController) NotPaymentList(c *gin.Context) {
 	page := new(base.Page)
 	page.SetPageSize(req.PageSize)
 	page.SetCurrent(req.Current)
-	//排序
+	// 排序
 	if req.SortType == "" {
 		req.SortType = "asc"
 	}
@@ -2234,7 +2218,7 @@ func (ct *InvoicePaymentController) NotPaymentList(c *gin.Context) {
 	}
 	fmt.Println("queryRegisterIds:", queryRegisterIds)
 
-	//fmt.Println("queryRegisterIds:",queryRegisterIds)
+	// fmt.Println("queryRegisterIds:",queryRegisterIds)
 	results := new(fms.NotInvoicePaymentCensusResp)
 	if len(queryRegisterIds) > 0 {
 		// 获取汇总数据IDs, 用于查询合计数据
@@ -2254,7 +2238,7 @@ func (ct *InvoicePaymentController) NotPaymentList(c *gin.Context) {
 			return
 		}
 
-		//fmt.Println("summaryIds:",summaryIds)
+		// fmt.Println("summaryIds:",summaryIds)
 		var listErr, totalErr, totalGroupErr error
 		wg := sync.WaitGroup{}
 
@@ -2284,11 +2268,12 @@ func (ct *InvoicePaymentController) NotPaymentList(c *gin.Context) {
 				return
 			}
 			summaryList = summaryData
-			//summaryIds := make([]int, 0)
-			//for i := range summaryList {
-			//	//summaryIds = append(summaryIds, summaryList[i].SummaryId)
+			// summaryIds := make([]int, 0)
+			//
+			//	for i := range summaryList {
+			//		//summaryIds = append(summaryIds, summaryList[i].SummaryId)
 			//
-			//}
+			// }
 			// 货币列表
 			currencyOB := new(fms.CurrencyUnit)
 			currencyCond := `enable = 1`
@@ -2387,7 +2372,7 @@ func (ct *InvoicePaymentController) NotPaymentList(c *gin.Context) {
 		invoiceCurrencyTotals := make([]*fms.InvoiceListCurrencyTotal, 0)
 		paymentCurrencyTotals := make([]*fms.InvoiceListCurrencyTotal, 0)
 		notpaymentCurrencyTotals := make([]*fms.InvoiceListCurrencyTotal, 0)
-		//contractAmountCurrencyTotals := make([]*fms.InvoiceListCurrencyTotal, 0)
+		// contractAmountCurrencyTotals := make([]*fms.InvoiceListCurrencyTotal, 0)
 		wg.Add(1)
 		go func() {
 			defer wg.Done()