Kaynağa Gözat

Merge remote-tracking branch 'origin/fix/2022-11-21' into debug

Roc 2 yıl önce
ebeveyn
işleme
532ca4c2e2

+ 3 - 2
controllers/base_from_calculate.go

@@ -1225,7 +1225,8 @@ func (this *CalculateController) Refresh() {
 			break
 		}
 		//startDate = edbInfo.StartDate
-		endDate = time.Now().Format(utils.FormatDate)
+		//endDate = time.Now().Format(utils.FormatDate)
+		endDate = ``   //只要填写日期,就会出现问题,还是把日期给去掉吧
 		startDate = `` //只要填写日期,就会出现问题,还是把日期给去掉吧
 		err = models.RefreshAllCalculateLjzzy(edbInfoId, source, fromEdbInfo, calculateLjzzy.EdbCode, startDate, endDate)
 		if err != nil && err.Error() != utils.ErrNoRow() {
@@ -1269,7 +1270,6 @@ func (this *CalculateController) Refresh() {
 			break
 		}
 	case utils.DATA_SOURCE_CALCULATE_NSZYDPJJS: //N数值移动平均计算
-		startDate = `` //只要填写日期,就会出现问题,还是把日期给去掉吧
 		calculateNszydpjjs, err := models.GetEdbInfoCalculateMappingDetail(edbInfoId)
 		if err != nil {
 			errMsg = "GetEdbInfoCalculateNszydpjjsDetail Err:" + err.Error()
@@ -1282,6 +1282,7 @@ func (this *CalculateController) Refresh() {
 		}
 		formulaInt, _ := strconv.Atoi(edbInfo.CalculateFormula)
 		//startDate = edbInfo.StartDate
+		startDate = `` //只要填写日期,就会出现问题,还是把日期给去掉吧
 		err = models.RefreshAllCalculateNszydpjjs(edbInfoId, edbInfo.Source, formulaInt, fromEdbInfo, calculateNszydpjjs.EdbCode, startDate)
 		if err != nil && err.Error() != utils.ErrNoRow() {
 			errMsg = "RefreshCalculateNszydpjjs Err:" + err.Error()

+ 1 - 1
models/base_from_wind.go

@@ -83,7 +83,7 @@ func RefreshEdbDataFromWind(edbInfoId int, edbCode, startDate string, item *serv
 
 		//如果传入的开始时间是空的,且当前数据日期早于传入的开始日期,那么需要判断下当前日期的数据是否存在
 		if !startDateTime.IsZero() && t.Before(startDateTime) {
-			tmpItem, tmpErr := GetEdbDataByDate(source, dateTime)
+			tmpItem, tmpErr := GetEdbDataByDate(source, edbCode, dateTime)
 			if tmpErr == nil && tmpItem != nil {
 				existMap[tmpItem.DataTime] = tmpItem
 			}

+ 3 - 3
models/edb_data_base.go

@@ -86,12 +86,12 @@ func GetEdbDataByCondition(source int, condition string, pars []interface{}) (it
 }
 
 // GetEdbDataByDate 根据数据日期获取指标数据
-func GetEdbDataByDate(source int, dataTime string) (item *EdbInfoSearchData, err error) {
+func GetEdbDataByDate(source int, edbCode, dataTime string) (item *EdbInfoSearchData, err error) {
 	o := orm.NewOrm()
 	tableName := GetEdbDataTableName(source)
-	sql := ` SELECT * FROM %s WHERE 1=1 and data_time =? ORDER BY data_time DESC `
+	sql := ` SELECT * FROM %s WHERE 1=1 AND edb_code = ? AND data_time =? ORDER BY data_time DESC `
 	sql = fmt.Sprintf(sql, tableName)
-	err = o.Raw(sql, dataTime).QueryRow(&item)
+	err = o.Raw(sql, edbCode, dataTime).QueryRow(&item)
 	return
 }
 

+ 2 - 2
models/edb_data_calculate_nszydbpjjs.go

@@ -198,8 +198,8 @@ func RefreshAllCalculateNszydpjjs(edbInfoId, source, formulaInt int, fromEdbInfo
 // refreshAllCalculateNszydpjjs 更新全部N数值移动平均计算
 func refreshAllCalculateNszydpjjs(to orm.TxOrmer, edbInfoId, source, formulaInt int, fromEdbInfo *EdbInfo, edbCode, startDate string) (err error) {
 	edbInfoIdStr := strconv.Itoa(edbInfoId)
-	//fmt.Println(edbInfoIdStr)
-	//fmt.Println("refreshAllCalculateNszydpjjs startDate:", startDate)
+	fmt.Println(edbInfoIdStr)
+	fmt.Println("refreshAllCalculateNszydpjjs startDate:", startDate)
 	//计算数据
 	var condition string
 	var pars []interface{}

+ 1 - 1
services/base_from_wind.go

@@ -31,7 +31,7 @@ func GetEdbDataFromWind(edbCode, startDate, endDate string) (item *EdbDataFromWi
 	body, err := http.Get(thsUrl)
 	fmt.Println("GetEdbDataByWind body:")
 	fmt.Println(string(body))
-	utils.FileLog.Info(fmt.Sprint("wind result:", string(body)))
+	utils.FileLog.Info(fmt.Sprint("指标编码:", edbCode, ";wind result:", string(body)))
 
 	if err != nil {
 		return