|
@@ -138,21 +138,22 @@ func DeleteAllEdbData(tradeCode string) (err error) {
|
|
|
}
|
|
|
|
|
|
type Edbinfo struct {
|
|
|
- TradeCode string `orm:"column(TRADE_CODE);pk" description:"指标code"`
|
|
|
- SecName string `orm:"column(SEC_NAME);" description:"指标名称"`
|
|
|
- Unit string `orm:"column(UNIT);" description:"单位"`
|
|
|
- Remark string `orm:"column(REMARK);" description:"备注"`
|
|
|
- Frequency string `description:"频度"`
|
|
|
- ClassifyId int `description:"分类id"`
|
|
|
- CreateDate string `description:"创建时间"`
|
|
|
- UserId int `description:"录入用户id"`
|
|
|
- UserName string `description:"录入用户名称"`
|
|
|
- NoticeTime string `description:"通知时间"`
|
|
|
- Mobile string `description:"录入者手机号"`
|
|
|
- ModifyTime string `description:"最近一次更新时间"`
|
|
|
- IsJoinEdb int8 `description:"指标库是否已添加:0-否;1-是"`
|
|
|
- StartDate string `description:"数据开始日期"`
|
|
|
- EndDate string `description:"数据结束日期"`
|
|
|
+ TradeCode string `orm:"column(TRADE_CODE);pk" description:"指标code"`
|
|
|
+ SecName string `orm:"column(SEC_NAME);" description:"指标名称"`
|
|
|
+ Unit string `orm:"column(UNIT);" description:"单位"`
|
|
|
+ Remark string `orm:"column(REMARK);" description:"备注"`
|
|
|
+ Frequency string `description:"频度"`
|
|
|
+ ClassifyId int `description:"分类id"`
|
|
|
+ CreateDate string `description:"创建时间"`
|
|
|
+ UserId int `description:"录入用户id"`
|
|
|
+ UserName string `description:"录入用户名称"`
|
|
|
+ NoticeTime string `description:"通知时间"`
|
|
|
+ Mobile string `description:"录入者手机号"`
|
|
|
+ ModifyTime string `description:"最近一次更新时间"`
|
|
|
+ IsJoinEdb int8 `description:"指标库是否已添加:0-否;1-是"`
|
|
|
+ StartDate string `description:"数据开始日期"`
|
|
|
+ EndDate string `description:"数据结束日期"`
|
|
|
+ LatestValue float64 `description:"指标最新值"`
|
|
|
}
|
|
|
|
|
|
func GetEdbinfoListCount(condition string, pars []interface{}, mobile string, roleType int) (count int, err error) {
|
|
@@ -179,21 +180,22 @@ func GetEdbinfoListCount(condition string, pars []interface{}, mobile string, ro
|
|
|
}
|
|
|
|
|
|
type EdbinfoItem struct {
|
|
|
- TradeCode string `orm:"column(TRADE_CODE);pk" description:"指标code"`
|
|
|
- SecName string `orm:"column(SEC_NAME);" description:"指标名称"`
|
|
|
- Unit string `orm:"column(UNIT);" description:"单位"`
|
|
|
- Remark string `orm:"column(REMARK);" description:"备注"`
|
|
|
- Frequency string `description:"频度"`
|
|
|
- ClassifyId int `description:"分类id"`
|
|
|
- ClassifyName string `description:"分类名称"`
|
|
|
- CreateDate string `description:"创建时间"`
|
|
|
- UserId int `description:"录入用户id"`
|
|
|
- UserName string `description:"录入用户名称"`
|
|
|
- NoticeTime string `description:"通知时间"`
|
|
|
- Mobile string `description:"录入者手机号"`
|
|
|
- ModifyTime string `description:"最近一次更新时间"`
|
|
|
- StartDate string `description:"数据开始日期"`
|
|
|
- EndDate string `description:"数据结束日期"`
|
|
|
+ TradeCode string `orm:"column(TRADE_CODE);pk" description:"指标code"`
|
|
|
+ SecName string `orm:"column(SEC_NAME);" description:"指标名称"`
|
|
|
+ Unit string `orm:"column(UNIT);" description:"单位"`
|
|
|
+ Remark string `orm:"column(REMARK);" description:"备注"`
|
|
|
+ Frequency string `description:"频度"`
|
|
|
+ ClassifyId int `description:"分类id"`
|
|
|
+ ClassifyName string `description:"分类名称"`
|
|
|
+ CreateDate string `description:"创建时间"`
|
|
|
+ UserId int `description:"录入用户id"`
|
|
|
+ UserName string `description:"录入用户名称"`
|
|
|
+ NoticeTime string `description:"通知时间"`
|
|
|
+ Mobile string `description:"录入者手机号"`
|
|
|
+ ModifyTime string `description:"最近一次更新时间"`
|
|
|
+ StartDate string `description:"数据开始日期"`
|
|
|
+ EndDate string `description:"数据结束日期"`
|
|
|
+ LatestValue float64 `description:"指标最新值"`
|
|
|
}
|
|
|
|
|
|
func GetEdbinfoItemList(condition string, pars []interface{}, startSize, pageSize int, mobile string, roleType int) (items []*EdbinfoItem, err error) {
|
|
@@ -1234,6 +1236,7 @@ type EdbInfoItem struct {
|
|
|
IsJoinEdb int8 `description:"指标库是否已添加:0-否;1-是"`
|
|
|
StartDate string `description:"数据开始日期"`
|
|
|
EndDate string `description:"数据结束日期"`
|
|
|
+ LatestValue float64 `description:"指标最新值"`
|
|
|
DataList []*Edbdata `description:"指标数据列表"`
|
|
|
}
|
|
|
|
|
@@ -1606,6 +1609,22 @@ func GetEdbdataMaxMinDate(tradeCode string) (item EdbinfoMaxMinDate, err error)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// GetEdbdataLatestValue
|
|
|
+// @Description: 获取手工数据的最新值
|
|
|
+// @author: Roc
|
|
|
+// @datetime 2024-08-02 10:33:22
|
|
|
+// @param tradeCode string
|
|
|
+// @return latestValue float64
|
|
|
+// @return err error
|
|
|
+func GetEdbdataLatestValue(tradeCode string) (latestValue float64, err error) {
|
|
|
+ o := orm.NewOrmUsingDB("edb")
|
|
|
+
|
|
|
+ sql := ` SELECT CLOSE FROM edbdata WHERE TRADE_CODE = ? ORDER BY DT DESC LIMIT 1`
|
|
|
+ err = o.Raw(sql, tradeCode).QueryRow(&latestValue)
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
// ModifyEdbinfoMaxMinDate
|
|
|
// @Description: 修改手工指标的最小最大日期
|
|
|
// @author: Roc
|
|
@@ -1614,11 +1633,11 @@ func GetEdbdataMaxMinDate(tradeCode string) (item EdbinfoMaxMinDate, err error)
|
|
|
// @param endDate string
|
|
|
// @param tradeCode string
|
|
|
// @return err error
|
|
|
-func ModifyEdbinfoMaxMinDate(startDate, endDate, tradeCode string) (err error) {
|
|
|
+func ModifyEdbinfoMaxMinDate(tradeCode, startDate, endDate string, latestValue float64) (err error) {
|
|
|
o := orm.NewOrmUsingDB("edb")
|
|
|
|
|
|
- sql := ` UPDATE edbinfo SET start_date = ?, end_date = ? WHERE TRADE_CODE = ? `
|
|
|
- _, err = o.Raw(sql, startDate, endDate, tradeCode).Exec()
|
|
|
+ sql := ` UPDATE edbinfo SET start_date = ?, end_date = ?, latest_value = ? , modify_time = now() WHERE TRADE_CODE = ? `
|
|
|
+ _, err = o.Raw(sql, startDate, endDate, latestValue, tradeCode).Exec()
|
|
|
|
|
|
return
|
|
|
}
|