|
@@ -51,15 +51,15 @@ func ModifyEdbDataSmm(edbCode, dataTime string, value float64) (err error) {
|
|
|
func RefreshEdbDataByYs(edbInfoId int, edbCode, startDate, endDate string) (err error) {
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
- condition += " AND base_from_smm_index_id=? "
|
|
|
- pars = append(pars, edbInfoId)
|
|
|
+ condition += " AND index_code=? "
|
|
|
+ pars = append(pars, edbCode)
|
|
|
|
|
|
- if startDate!="" {
|
|
|
+ if startDate != "" {
|
|
|
condition += " AND data_time>=? "
|
|
|
pars = append(pars, startDate)
|
|
|
}
|
|
|
|
|
|
- if endDate!="" {
|
|
|
+ if endDate != "" {
|
|
|
condition += " AND data_time<=? "
|
|
|
pars = append(pars, endDate)
|
|
|
}
|
|
@@ -82,10 +82,12 @@ func RefreshEdbDataByYs(edbInfoId int, edbCode, startDate, endDate string) (err
|
|
|
|
|
|
existMap := make(map[string]float64)
|
|
|
for _, ev := range existDataList {
|
|
|
+ fmt.Println(ev.DataTime, ev.Value)
|
|
|
existMap[ev.DataTime] = ev.Value
|
|
|
}
|
|
|
ysList := make([]*EdbDataYs, 0)
|
|
|
for _, dv := range ysBaseDataAll {
|
|
|
+ fmt.Println("baseDataAll:", dv.DataTime, dv.Value)
|
|
|
if existItem, ok := existMap[dv.DataTime]; !ok { //新增
|
|
|
dataDate, _ := time.Parse(utils.FormatDate, dv.DataTime)
|
|
|
timestamp := dataDate.UnixNano() / 1e6
|
|
@@ -101,11 +103,13 @@ func RefreshEdbDataByYs(edbInfoId int, edbCode, startDate, endDate string) (err
|
|
|
ysList = append(ysList, item)
|
|
|
} else {
|
|
|
if dv.Value != existItem { //修改
|
|
|
+ fmt.Println("ModifyEdbDataSmm:", edbCode, dv.DataTime, dv.Value)
|
|
|
ModifyEdbDataSmm(edbCode, dv.DataTime, dv.Value)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if len(ysList) > 0 {
|
|
|
+ fmt.Println("AddEdbDataSmm")
|
|
|
err = AddEdbDataSmm(ysList)
|
|
|
if err != nil {
|
|
|
return
|