Explorar o código

Merge branch 'feature/eta1.6.5_db_calculate' into debug

xyxie hai 1 ano
pai
achega
6b551e4911

+ 4 - 0
controllers/data_manage/edb_info_calculate.go

@@ -156,6 +156,7 @@ func (this *ChartInfoController) CalculateSave() {
 		EmptyType:        req.EmptyType,
 		MaxEmptyType:     req.MaxEmptyType,
 		EdbInfoIdArr:     req.EdbInfoIdArr,
+		Extra:            req.Extra,
 	}
 	reqJson, err := json.Marshal(req2)
 	if err != nil {
@@ -385,6 +386,7 @@ func (this *ChartInfoController) CalculateEdit() {
 		EdbInfoIdArr:     req.EdbInfoIdArr,
 		EmptyType:        req.EmptyType,
 		MaxEmptyType:     req.MaxEmptyType,
+		Extra:            req.Extra,
 	}
 	reqJson, err := json.Marshal(req2)
 	if err != nil {
@@ -576,6 +578,7 @@ func (this *ChartInfoController) CalculateBatchSave() {
 		//CalculateFormula: edbInfo.CalculateFormula,
 		EdbInfoIdArr: req.EdbInfoIdArr,
 		Calendar:     req.Calendar,
+		Extra:        req.Extra,
 	}
 
 	// 调用指标库去更新
@@ -782,6 +785,7 @@ func (this *ChartInfoController) CalculateBatchEdit() {
 		MoveFrequency: req.MoveFrequency,
 		EdbInfoIdArr:  req.EdbInfoIdArr,
 		Calendar:      req.Calendar,
+		Extra:         req.Extra,
 	}
 
 	// 调用指标库去更新

+ 1 - 0
models/data_manage/edb_info.go

@@ -56,6 +56,7 @@ type EdbInfo struct {
 	SubSourceName    string  `description:"子数据来源名称"`
 	IndicatorCode    string  `description:"指标代码"`
 	StockCode        string  `description:"证券代码"`
+	Extra            string  `description:"指标额外配置"`
 }
 
 type EdbInfoFullClassify struct {

+ 10 - 1
models/data_manage/edb_info_calculate.go

@@ -20,6 +20,7 @@ type EdbInfoCalculateSaveReq struct {
 	Calendar         string           `description:"公历/农历"`
 	EmptyType        int              `description:"空值处理类型(0查找前后35天,1不计算,2前值填充,3后值填充,4等于0)"`
 	MaxEmptyType     int              `description:"MAX、MIN公式空值处理类型(1、等于0;2、跳过空值)"`
+	Extra            string           `description:"指标的额外配置"`
 	EdbInfoIdArr     []EdbInfoFromTag `description:"指标信息"`
 }
 
@@ -74,6 +75,9 @@ type EdbInfoCalculateDetail struct {
 	StartDate          string    `description:"开始日期"`
 	EndDate            string    `description:"结束日期"`
 	EdbType            int       `description:"指标类型:1:基础指标,2:计算指标"`
+	Frequency          string    `description:"频率"`
+	Unit               string    `description:"单位"`
+	ClassifyId         int       `description:"分类id"`
 }
 
 func GetEdbInfoCalculateDetail(edbInfoId, source int) (list []*EdbInfoCalculateDetail, err error) {
@@ -86,7 +90,7 @@ func GetEdbInfoCalculateDetail(edbInfoId, source int) (list []*EdbInfoCalculateD
 	//
 	//sql = fmt.Sprintf(sql, calculateTableName)
 
-	sql := ` SELECT a.edb_info_calculate_mapping_id,a.edb_info_id,a.source,a.source_name,a.edb_code,a.from_edb_info_id,a.from_edb_code,a.from_source,a.from_source_name,a.sort,a.create_time,a.modify_time,a.from_tag,a.move_value,b.edb_name_source as from_edb_name,b.start_date,b.end_date,b.edb_type FROM edb_info_calculate_mapping AS a
+	sql := ` SELECT a.edb_info_calculate_mapping_id,a.edb_info_id,a.source,a.source_name,a.edb_code,a.from_edb_info_id,a.from_edb_code,a.from_source,a.from_source_name,a.sort,a.create_time,a.modify_time,a.from_tag,a.move_value,b.edb_name_source as from_edb_name,b.start_date,b.end_date,b.edb_type, b.frequency, b.unit, b.classify_id FROM edb_info_calculate_mapping AS a
 			INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
 			WHERE a.edb_info_id=? ORDER BY sort ASC `
 
@@ -109,6 +113,7 @@ type EdbInfoCalculateEditReq struct {
 	EmptyType        int              `description:"空值处理类型(0查找前后35天,1不计算,2前值填充,3后值填充,4等于0)"`
 	MaxEmptyType     int              `description:"MAX、MIN公式空值处理类型(1、等于0;2、跳过空值)"`
 	EdbInfoIdArr     []EdbInfoFromTag `description:"指标信息"`
+	Extra            string           `description:"指标的额外配置"`
 }
 
 func GetCalculateEdbInfo(edbInfoId int) (from_edb_info_id string, err error) {
@@ -166,6 +171,7 @@ type EdbInfoCalculateBatchSaveReq struct {
 	MoveType         int              `description:"移动方式:1:领先(默认),2:滞后"`
 	MoveFrequency    string           `description:"移动频度:天/周/月/季/年"`
 	Calendar         string           `description:"公历/农历"`
+	Extra            string           `description:"指标的额外配置"`
 }
 
 type EdbInfoCalculateBatchEditReq struct {
@@ -181,6 +187,7 @@ type EdbInfoCalculateBatchEditReq struct {
 	MoveFrequency string `description:"移动频度:天/周/月/季/年"`
 	Calendar      string `description:"公历/农历"`
 	EdbInfoIdArr  []EdbInfoFromTag
+	Extra         string `description:"指标的额外配置"`
 }
 
 // EdbInfoCalculateBatchSaveReqByEdbLib edb指标库的请求逻辑
@@ -202,6 +209,7 @@ type EdbInfoCalculateBatchSaveReqByEdbLib struct {
 	Calendar         string           `description:"公历/农历"`
 	EmptyType        int              `description:"空值处理类型(0查找前后35天,1不计算,2前值填充,3后值填充,4等于0)"`
 	MaxEmptyType     int              `description:"MAX、MIN公式空值处理类型(1、等于0;2、跳过空值)"`
+	Extra            string           `description:"指标的额外配置"`
 }
 
 // EdbInfoCalculateBatchEditReq 编辑计算指标的请求参数
@@ -218,6 +226,7 @@ type EdbInfoCalculateBatchEditReqByEdbLib struct {
 	MoveFrequency string `description:"移动频度:天/周/月/季/年"`
 	Calendar      string `description:"公历/农历"`
 	EdbInfoIdArr  []EdbInfoFromTag
+	Extra         string `description:"指标的额外配置"`
 }
 
 func GetEdbInfoCalculateMap(edbInfoId, source int) (list []*EdbInfo, err error) {

+ 2 - 0
services/aws_s3.go

@@ -9,6 +9,7 @@ import (
 	"github.com/aws/aws-sdk-go/aws/session"
 	"github.com/aws/aws-sdk-go/service/s3"
 	"io/ioutil"
+	"os"
 	"time"
 )
 
@@ -58,6 +59,7 @@ func (m *S3Oss) UploadFile(fileName, localFile, savePath string) (resourceUrl st
 		if err != nil {
 			fmt.Println(err.Error())
 		}
+		_ = os.Remove(localFile)
 	}()
 
 	endpoint := utils.S3Endpoint

+ 4 - 0
services/minio.go

@@ -7,6 +7,7 @@ import (
 	"github.com/minio/minio-go/v7"
 	"github.com/minio/minio-go/v7/pkg/credentials"
 	"log"
+	"os"
 	"time"
 )
 
@@ -351,6 +352,9 @@ type MinioOss struct{}
 
 // UploadFile 上传文件
 func (m *MinioOss) UploadFile(fileName, filePath, savePath string) (string, error) {
+	defer func() {
+		_ = os.Remove(filePath)
+	}()
 	if utils.MinIoAccessKeyId == `` || utils.MinIoAccessKeySecret == `` {
 		return "0", errors.New("MinIo信息未配置")
 	}

+ 4 - 0
services/oss.go

@@ -6,6 +6,7 @@ import (
 	"eta/eta_mobile/services/alarm_msg"
 	"fmt"
 	"github.com/aliyun/aliyun-oss-go-sdk/oss"
+	"os"
 	"time"
 
 	"eta/eta_mobile/utils"
@@ -293,6 +294,9 @@ type AliOss struct{}
 
 // UploadFile 上传文件
 func (m *AliOss) UploadFile(fileName, filePath, savePath string) (string, error) {
+	defer func() {
+		_ = os.Remove(filePath)
+	}()
 	if utils.AccessKeyId == `` {
 		return "0", errors.New("阿里云信息未配置")
 	}