Explorar o código

残差分析 领先指标

gmy hai 3 semanas
pai
achega
25e5abe17b

+ 4 - 4
services/residual_analysis_service/residual_analysis_service.go

@@ -110,10 +110,10 @@ func ResidualAnalysisPreview(req residual_analysis_model.ResidualAnalysisReq) (r
 	}
 
 	if req.ResidualType == 2 {
-		resp.A = a
-		resp.B = b
-		resp.R = r
-		resp.R2 = R2
+		resp.A = math.Round(a*10000) / 10000
+		resp.B = math.Round(b*10000) / 10000
+		resp.R = math.Round(r*10000) / 10000
+		resp.R2 = math.Round(R2*10000) / 10000
 	}
 
 	return resp, nil

+ 1 - 1
utils/date_util.go

@@ -70,7 +70,7 @@ func AddDate(t time.Time, years, months int) time.Time {
 	targetMonth = (targetMonth-1)%12 + 1
 
 	// 计算目标年份
-	targetYear := t.Year() + years + (int(month)+months)/12
+	targetYear := t.Year() + years + (int(month)+months-1)/12
 
 	// 计算目标月份最大天数
 	maxDayOfTargetMonth := daysOfMonth[targetMonth-1]