ziwen 2 年之前
父节点
当前提交
1973ac0474
共有 1 个文件被更改,包括 18 次插入16 次删除
  1. 18 16
      controller/statistic.go

+ 18 - 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
@@ -151,8 +151,10 @@ func getIncomeListV2(ch chan models.IncomeChartResp) (incomeChart models.IncomeC
 			cond := `1 = 1`
 			pars := make([]interface{}, 0)
 
-			cond += ` AND ((c.invoice_time BETWEEN ? AND ?) or (d.invoice_time BETWEEN ? AND ?)) `
-			pars = append(pars, startDate, endDate, startDate, endDate)
+			st := fmt.Sprint(startDate, " 00:00:00")
+			ed := fmt.Sprint(endDate, " 23:59:59")
+			cond += ` AND ((c.invoice_time BETWEEN ? AND ?) or (d.invoice_time BETWEEN ? AND ?))`
+			pars = append(pars, st, ed, st, ed)
 
 			summaryIds, e := fms.GetInvoicePaymentCensusSummaryDataIds(cond, pars)
 			if e != nil {
@@ -186,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
 }