ziwen há 1 ano atrás
pai
commit
bd61eeaccc
1 ficheiros alterados com 17 adições e 16 exclusões
  1. 17 16
      controller/statistic.go

+ 17 - 16
controller/statistic.go

@@ -116,11 +116,11 @@ func getIncomeListV2(ch chan models.IncomeChartResp) (incomeChart models.IncomeC
 		}
 		ch <- incomeChart
 	}()
-	todayStr := utils.GetToday("20060102")
-	key := "admin:home:fmsIncomeList:" + todayStr
+	//todayStr := utils.GetToday("20060102")
+	//key := "admin:home:fmsIncomeList:" + todayStr
 
-	redisJsonData, redisErr := global.Redis.Get(context.TODO(), key).Result()
-	if redisErr != nil {
+	//redisJsonData, redisErr := global.Redis.Get(context.TODO(), key).Result()
+	//if redisErr != nil {
 		var dateSlice []string
 		var contractMoneySlice []float64
 		var ArrivalMoneySlice []float64
@@ -164,9 +164,10 @@ func getIncomeListV2(ch chan models.IncomeChartResp) (incomeChart models.IncomeC
 			var invoiceTotal, paymentTotal float64
 
 			if len(summaryIds) > 0 {
-				amountTotalCond := `a.id IN ?`
+				//amountTotalCond := `a.id IN ?`
+				amountTotalCond := `a.id IN ? AND (b.invoice_time BETWEEN ? AND ?)`
 				amountTotalPars := make([]interface{}, 0)
-				amountTotalPars = append(amountTotalPars, summaryIds)
+				amountTotalPars = append(amountTotalPars, summaryIds, st, ed)
 				invoiceSum, e := fms.GetContractSummaryInvoicePaymentAmountTotal(amountTotalCond, amountTotalPars, 1)
 				if e != nil {
 					return
@@ -187,16 +188,16 @@ func getIncomeListV2(ch chan models.IncomeChartResp) (incomeChart models.IncomeC
 		incomeChart.ContractMoney = contractMoneySlice
 		incomeChart.ArrivalMoney = ArrivalMoneySlice
 
-		redisJsonData, err := json.Marshal(incomeChart)
-		if err == nil {
-			global.Redis.SetEX(context.TODO(), key, string(redisJsonData), time.Minute*30)
-		}
-	}else {
-		err = json.Unmarshal([]byte(redisJsonData), &incomeChart)
-		if err != nil {
-			fmt.Println("近两年的收入统计数据,json转换失败")
-		}
-	}
+		//redisJsonData, err := json.Marshal(incomeChart)
+		//if err == nil {
+		//	global.Redis.SetEX(context.TODO(), key, string(redisJsonData), time.Minute*30)
+		//}
+	//}else {
+		//err = json.Unmarshal([]byte(redisJsonData), &incomeChart)
+		//if err != nil {
+		//	fmt.Println("近两年的收入统计数据,json转换失败")
+		//}
+	//}
 
 	return
 }