|
@@ -3,7 +3,7 @@ package services
|
|
|
import (
|
|
|
"context"
|
|
|
"encoding/json"
|
|
|
- "eta/eta_forum_task/models"
|
|
|
+ "eta/eta_forum_task/models"
|
|
|
"eta/eta_forum_task/services/alarm_msg"
|
|
|
"eta/eta_forum_task/services/eta_forum"
|
|
|
"eta/eta_forum_task/utils"
|
|
@@ -143,11 +143,13 @@ func UpdateChart(chartInfoId int) (err error, errMsg string) {
|
|
|
return
|
|
|
}
|
|
|
// 更新投研资源库里的图表和指标绑定关系
|
|
|
- err = models.UpdateForumChartEdbMapping(chartInfoId, edbInfoStr)
|
|
|
- if err != nil {
|
|
|
- errMsg = "更新投研资源库里的图表和指标绑定关系失败"
|
|
|
- err = fmt.Errorf("更新投研资源库里的图表和指标绑定关系失败,Err:" + err.Error())
|
|
|
- return
|
|
|
+ if oldEdbInfoStr != edbInfoStr {
|
|
|
+ err = models.UpdateForumChartEdbMapping(chartInfoId, edbInfoStr)
|
|
|
+ if err != nil {
|
|
|
+ errMsg = "更新投研资源库里的图表和指标绑定关系失败"
|
|
|
+ err = fmt.Errorf("更新投研资源库里的图表和指标绑定关系失败,Err:" + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
return
|
|
|
}
|
|
@@ -312,7 +314,7 @@ func ChartInfoSaveBatch() (err error) {
|
|
|
success := 0
|
|
|
|
|
|
// 循环更新100个图表数据
|
|
|
- for i := 0; offset < total; i++ {
|
|
|
+ for i := 0; offset <= total; i++ {
|
|
|
// 查询需要更新的图表信息
|
|
|
chartInfos, e := models.GetChartInfoListByCondition(condition, []interface{}{}, offset, pageSize)
|
|
|
if e != nil {
|
|
@@ -337,11 +339,12 @@ func ChartInfoSaveBatch() (err error) {
|
|
|
success += 1
|
|
|
}
|
|
|
|
|
|
- offset = (i + 1) * pageSize
|
|
|
+ offset += pageSize
|
|
|
}
|
|
|
utils.FileLog.Info("更新图表数据完成, 更新图表数据总数:", success)
|
|
|
}
|
|
|
-
|
|
|
+ // 更新指标数据
|
|
|
+ utils.Rc.LPush(utils.CACHE_KEY_EDB_DATA_UPDATE_LOG, []byte("1"))
|
|
|
sysUser, err := models.GetSysUserByAdminName("admin")
|
|
|
if err != nil {
|
|
|
err = fmt.Errorf("获取系统用户失败,Err:" + err.Error())
|
|
@@ -379,7 +382,7 @@ func ChartInfoSaveBatch() (err error) {
|
|
|
success := 0
|
|
|
|
|
|
// 循环更新100个图表数据
|
|
|
- for i := 0; offset < total; i++ {
|
|
|
+ for i := 0; offset <= total; i++ {
|
|
|
// 查询需要更新的图表信息
|
|
|
chartInfos, e := models.GetChartInfoListByCondition(condition, []interface{}{chartClassifyIdList}, offset, pageSize)
|
|
|
if e != nil {
|
|
@@ -404,12 +407,11 @@ func ChartInfoSaveBatch() (err error) {
|
|
|
success += 1
|
|
|
}
|
|
|
|
|
|
- offset = (i + 1) * pageSize
|
|
|
+ offset += pageSize
|
|
|
}
|
|
|
utils.FileLog.Info("上传图表数据完成, 上传图表数据总数:", success)
|
|
|
|
|
|
- // 更新指标数据
|
|
|
- utils.Rc.LPush(utils.CACHE_KEY_EDB_DATA_UPDATE_LOG, []byte("1"))
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
|