|
@@ -140,8 +140,8 @@ type EdbCalculateSaveMultiResponse struct {
|
|
|
}
|
|
|
|
|
|
// SaveBasePredictEdbData 新增/编辑预测指标运算
|
|
|
-func SaveBasePredictEdbData(edbInfoCalculateBatchSaveReqStr string) (resp *AddPredictEdbDataResponse, err error) {
|
|
|
- _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "predict/save")
|
|
|
+func SaveBasePredictEdbData(edbInfoCalculateBatchSaveReqStr, lang string) (resp *AddPredictEdbDataResponse, err error) {
|
|
|
+ _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "predict/save", lang)
|
|
|
err = json.Unmarshal(resultByte, &resp)
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -161,8 +161,8 @@ type PredictRuleCalculateByNineRespResponse struct {
|
|
|
}
|
|
|
|
|
|
// PredictCalculateByNinePreview 预测指标动态环差演算
|
|
|
-func PredictCalculateByNinePreview(RuleConfigReqStr string) (resp *PredictRuleCalculateByNineRespResponse, err error) {
|
|
|
- _, resultByte, err := postAddEdbData(RuleConfigReqStr, "predict/calculate_by_nine/preview")
|
|
|
+func PredictCalculateByNinePreview(RuleConfigReqStr, lang string) (resp *PredictRuleCalculateByNineRespResponse, err error) {
|
|
|
+ _, resultByte, err := postAddEdbData(RuleConfigReqStr, "predict/calculate_by_nine/preview", lang)
|
|
|
err = json.Unmarshal(resultByte, &resp)
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -171,8 +171,8 @@ func PredictCalculateByNinePreview(RuleConfigReqStr string) (resp *PredictRuleCa
|
|
|
}
|
|
|
|
|
|
// SavePredictEdbData 新增/编辑预测指标运算
|
|
|
-func SavePredictEdbData(edbInfoCalculateBatchSaveReqStr string) (resp *AddPredictEdbDataResponse, err error) {
|
|
|
- _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "predict_calculate/save")
|
|
|
+func SavePredictEdbData(edbInfoCalculateBatchSaveReqStr, lang string) (resp *AddPredictEdbDataResponse, err error) {
|
|
|
+ _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "predict_calculate/save", lang)
|
|
|
err = json.Unmarshal(resultByte, &resp)
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -181,8 +181,8 @@ func SavePredictEdbData(edbInfoCalculateBatchSaveReqStr string) (resp *AddPredic
|
|
|
}
|
|
|
|
|
|
// BatchSavePredictEdbData 新增/编辑 预测指标运算(同比、同差)
|
|
|
-func BatchSavePredictEdbData(edbInfoCalculateBatchSaveReqStr string) (resp *AddPredictEdbDataResponse, err error) {
|
|
|
- _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "predict_calculate/batch/save")
|
|
|
+func BatchSavePredictEdbData(edbInfoCalculateBatchSaveReqStr, lang string) (resp *AddPredictEdbDataResponse, err error) {
|
|
|
+ _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "predict_calculate/batch/save", lang)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -302,8 +302,8 @@ func RefreshPredictEdbCalculateData(edbInfoId int, edbCode, startDate string) (r
|
|
|
}
|
|
|
|
|
|
// AddEdbCalculateData 新增 累计值转月-同比值-同差等计算新增
|
|
|
-func AddEdbCalculateData(edbInfoCalculateBatchSaveReqStr string) (resp *AddPredictEdbDataResponse, err error) {
|
|
|
- _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "calculate/add")
|
|
|
+func AddEdbCalculateData(edbInfoCalculateBatchSaveReqStr, lang string) (resp *AddPredictEdbDataResponse, err error) {
|
|
|
+ _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "calculate/add", lang)
|
|
|
err = json.Unmarshal(resultByte, &resp)
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -312,8 +312,8 @@ func AddEdbCalculateData(edbInfoCalculateBatchSaveReqStr string) (resp *AddPredi
|
|
|
}
|
|
|
|
|
|
// EditEdbCalculateData 编辑 累计值转月-同比值-同差等计算新增
|
|
|
-func EditEdbCalculateData(edbInfoCalculateBatchSaveReqStr string) (resp *AddPredictEdbDataResponse, err error) {
|
|
|
- _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "calculate/edit")
|
|
|
+func EditEdbCalculateData(edbInfoCalculateBatchSaveReqStr, lang string) (resp *AddPredictEdbDataResponse, err error) {
|
|
|
+ _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "calculate/edit", lang)
|
|
|
err = json.Unmarshal(resultByte, &resp)
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -322,8 +322,8 @@ func EditEdbCalculateData(edbInfoCalculateBatchSaveReqStr string) (resp *AddPred
|
|
|
}
|
|
|
|
|
|
// BatchSaveEdbCalculateData 新增 累计值转月-同比值-同差等计算新增
|
|
|
-func BatchSaveEdbCalculateData(edbInfoCalculateBatchSaveReqStr string) (resp *AddPredictEdbDataResponse, err error) {
|
|
|
- _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "calculate/batch/save")
|
|
|
+func BatchSaveEdbCalculateData(edbInfoCalculateBatchSaveReqStr, lang string) (resp *AddPredictEdbDataResponse, err error) {
|
|
|
+ _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "calculate/batch/save", lang)
|
|
|
err = json.Unmarshal(resultByte, &resp)
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -332,8 +332,8 @@ func BatchSaveEdbCalculateData(edbInfoCalculateBatchSaveReqStr string) (resp *Ad
|
|
|
}
|
|
|
|
|
|
// BatchEditEdbCalculateData 编辑 累计值转月-同比值-同差等计算新增
|
|
|
-func BatchEditEdbCalculateData(edbInfoCalculateBatchSaveReqStr string) (resp *AddPredictEdbDataResponse, err error) {
|
|
|
- _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "calculate/batch/edit")
|
|
|
+func BatchEditEdbCalculateData(edbInfoCalculateBatchSaveReqStr, lang string) (resp *AddPredictEdbDataResponse, err error) {
|
|
|
+ _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "calculate/batch/edit", lang)
|
|
|
err = json.Unmarshal(resultByte, &resp)
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -342,8 +342,8 @@ func BatchEditEdbCalculateData(edbInfoCalculateBatchSaveReqStr string) (resp *Ad
|
|
|
}
|
|
|
|
|
|
// BatchSaveEdbCalculateMultiData 批量新增 累计值转月-同比值-同差等计算新增
|
|
|
-func BatchSaveEdbCalculateMultiData(edbInfoCalculateBatchSaveReqStr string) (resp *EdbCalculateSaveMultiResponse, err error) {
|
|
|
- _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "calculate/batch/save/multi")
|
|
|
+func BatchSaveEdbCalculateMultiData(edbInfoCalculateBatchSaveReqStr, lang string) (resp *EdbCalculateSaveMultiResponse, err error) {
|
|
|
+ _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "calculate/batch/save/multi", lang)
|
|
|
err = json.Unmarshal(resultByte, &resp)
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -352,8 +352,8 @@ func BatchSaveEdbCalculateMultiData(edbInfoCalculateBatchSaveReqStr string) (res
|
|
|
}
|
|
|
|
|
|
// BatchEditEdbCalculateMultiData 批量编辑 累计值转月-同比值-同差等计算新增
|
|
|
-func BatchEditEdbCalculateMultiData(edbInfoCalculateBatchSaveReqStr string) (resp *EdbCalculateSaveMultiResponse, err error) {
|
|
|
- _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "calculate/batch/edit/multi")
|
|
|
+func BatchEditEdbCalculateMultiData(edbInfoCalculateBatchSaveReqStr, lang string) (resp *EdbCalculateSaveMultiResponse, err error) {
|
|
|
+ _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "calculate/batch/edit/multi", lang)
|
|
|
err = json.Unmarshal(resultByte, &resp)
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -377,32 +377,32 @@ func ExecPythonCode(pythonCode string) (resp *models.BaseResponse, err error) {
|
|
|
}
|
|
|
|
|
|
// AddPythonEdbData 新增python指标
|
|
|
-func AddPythonEdbData(param string) (resp *models.BaseResponse, err error) {
|
|
|
+func AddPythonEdbData(param, lang string) (resp *models.BaseResponse, err error) {
|
|
|
urlStr := ``
|
|
|
urlStr = "python/add"
|
|
|
- resp, _, err = postAddEdbData(param, urlStr)
|
|
|
+ resp, _, err = postAddEdbData(param, urlStr, lang)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// EditPythonEdbData 编辑python指标
|
|
|
-func EditPythonEdbData(param string) (resp *models.BaseResponse, err error) {
|
|
|
+func EditPythonEdbData(param, lang string) (resp *models.BaseResponse, err error) {
|
|
|
urlStr := ``
|
|
|
urlStr = "python/edit"
|
|
|
- resp, _, err = postAddEdbData(param, urlStr)
|
|
|
+ resp, _, err = postAddEdbData(param, urlStr, lang)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// SaveAdjustEdbInfo 保存数据调整指标
|
|
|
-func SaveAdjustEdbInfo(param string) (resp *models.BaseResponse, err error) {
|
|
|
+func SaveAdjustEdbInfo(param, lang string) (resp *models.BaseResponse, err error) {
|
|
|
urlStr := ``
|
|
|
urlStr = "calculate/adjust/save"
|
|
|
- resp, _, err = postAddEdbData(param, urlStr)
|
|
|
+ resp, _, err = postAddEdbData(param, urlStr, lang)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// ResetCustomAnalysisData 重置自定义表格的数据
|
|
|
-func ResetCustomAnalysisData(reqStr string) (resp *AddPredictEdbDataResponse, err error) {
|
|
|
- _, resultByte, err := postAddEdbData(reqStr, "calculate/custom_analysis/reset")
|
|
|
+func ResetCustomAnalysisData(reqStr, lang string) (resp *AddPredictEdbDataResponse, err error) {
|
|
|
+ _, resultByte, err := postAddEdbData(reqStr, "calculate/custom_analysis/reset", lang)
|
|
|
err = json.Unmarshal(resultByte, &resp)
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -423,8 +423,8 @@ type CalculateComputeCorrelationResp struct {
|
|
|
}
|
|
|
|
|
|
// CalculateComputeCorrelation 拟合残差计算相关性的值
|
|
|
-func CalculateComputeCorrelation(edbInfoCalculateBatchSaveReqStr string) (resp *CalculateComputeCorrelationResp, err error) {
|
|
|
- _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "calculate/compute_correlation")
|
|
|
+func CalculateComputeCorrelation(edbInfoCalculateBatchSaveReqStr, lang string) (resp *CalculateComputeCorrelationResp, err error) {
|
|
|
+ _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "calculate/compute_correlation", lang)
|
|
|
err = json.Unmarshal(resultByte, &resp)
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -433,8 +433,8 @@ func CalculateComputeCorrelation(edbInfoCalculateBatchSaveReqStr string) (resp *
|
|
|
}
|
|
|
|
|
|
// PredictCalculateComputeCorrelation 拟合残差计算相关性的值(预测指标)
|
|
|
-func PredictCalculateComputeCorrelation(edbInfoCalculateBatchSaveReqStr string) (resp *CalculateComputeCorrelationResp, err error) {
|
|
|
- _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "predict_calculate/compute_correlation")
|
|
|
+func PredictCalculateComputeCorrelation(edbInfoCalculateBatchSaveReqStr, lang string) (resp *CalculateComputeCorrelationResp, err error) {
|
|
|
+ _, resultByte, err := postAddEdbData(edbInfoCalculateBatchSaveReqStr, "predict_calculate/compute_correlation", lang)
|
|
|
err = json.Unmarshal(resultByte, &resp)
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -462,9 +462,9 @@ type BaseCalculateDataResp struct {
|
|
|
}
|
|
|
|
|
|
// BaseCalculate 基础计算
|
|
|
-func BaseCalculate(param string) (resp *BaseCalculateResp, err error) {
|
|
|
+func BaseCalculate(param, lang string) (resp *BaseCalculateResp, err error) {
|
|
|
urlStr := "calculate/base"
|
|
|
- _, resultByte, err := postAddEdbData(param, urlStr)
|
|
|
+ _, resultByte, err := postAddEdbData(param, urlStr, lang)
|
|
|
err = json.Unmarshal(resultByte, &resp)
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -479,7 +479,7 @@ func postRefreshEdbData(param map[string]interface{}, urlStr string) (resp *mode
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
- result, err := HttpPost(postUrl, string(postData), "application/json")
|
|
|
+ result, err := HttpPost(postUrl, string(postData), utils.ZhLangVersion, "application/json")
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -492,9 +492,9 @@ func postRefreshEdbData(param map[string]interface{}, urlStr string) (resp *mode
|
|
|
}
|
|
|
|
|
|
// postAddEdbData 新增指标数据
|
|
|
-func postAddEdbData(paramStr string, urlStr string) (resp *models.BaseResponse, result []byte, err error) {
|
|
|
+func postAddEdbData(paramStr string, urlStr, lang string) (resp *models.BaseResponse, result []byte, err error) {
|
|
|
postUrl := utils.EDB_LIB_URL + urlStr
|
|
|
- result, err = HttpPost(postUrl, paramStr, "application/json")
|
|
|
+ result, err = HttpPost(postUrl, paramStr, lang, "application/json")
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -506,7 +506,7 @@ func postAddEdbData(paramStr string, urlStr string) (resp *models.BaseResponse,
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func HttpPost(url, postData string, params ...string) ([]byte, error) {
|
|
|
+func HttpPost(url, postData, lang string, params ...string) ([]byte, error) {
|
|
|
body := ioutil.NopCloser(strings.NewReader(postData))
|
|
|
client := &http.Client{}
|
|
|
req, err := http.NewRequest("POST", url, body)
|
|
@@ -518,6 +518,7 @@ func HttpPost(url, postData string, params ...string) ([]byte, error) {
|
|
|
contentType = params[0]
|
|
|
}
|
|
|
req.Header.Set("Content-Type", contentType)
|
|
|
+ req.Header.Set("Lang", lang)
|
|
|
req.Header.Set("authorization", utils.MD5(utils.APP_EDB_LIB_NAME_EN+utils.EDB_LIB_Md5_KEY))
|
|
|
resp, err := client.Do(req)
|
|
|
if err != nil {
|