|
@@ -76,7 +76,7 @@ func (this *BaseFromRzdController) Refresh() {
|
|
this.Data["json"] = br
|
|
this.Data["json"] = br
|
|
this.ServeJSON()
|
|
this.ServeJSON()
|
|
}()
|
|
}()
|
|
- source := utils.DATA_SOURCE_LY
|
|
|
|
|
|
+ source := utils.DATA_SOURCE_RZD
|
|
var req models.RefreshEdbInfoReq
|
|
var req models.RefreshEdbInfoReq
|
|
err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -262,6 +262,32 @@ func (this *BaseFromRzdController) AddBatchRzdData() {
|
|
br.ErrMsg = "新增指标数据失败,Err:" + err.Error()
|
|
br.ErrMsg = "新增指标数据失败,Err:" + err.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ // 同步新增指标库数据
|
|
|
|
+ // 判断是否存在于指标库
|
|
|
|
+ // 获取指标详情
|
|
|
|
+ var dataList []models.EdbDataRzd
|
|
|
|
+ for _, data := range req {
|
|
|
|
+ edbInfo, err := models.GetEdbInfoByEdbCode(utils.DATA_SOURCE_RZD, data.IndexCode)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "指标不存在!"
|
|
|
|
+ br.ErrMsg = "指标不存在"
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if edbInfo.EdbInfoId == 0 {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ dataRzd := models.EdbDataRzd{
|
|
|
|
+ EdbInfoId: data.BaseFromRzdIndexId,
|
|
|
|
+ DataTime: data.DataTime,
|
|
|
|
+ Value: data.Value,
|
|
|
|
+ EdbCode: data.IndexCode,
|
|
|
|
+ CreateTime: utils.GetCurrentTime(),
|
|
|
|
+ ModifyTime: utils.GetCurrentTime(),
|
|
|
|
+ DataTimestamp: uint64(time.Now().UnixNano() / int64(time.Millisecond)),
|
|
|
|
+ }
|
|
|
|
+ dataList = append(dataList, dataRzd)
|
|
|
|
+ }
|
|
|
|
+ _ = models.AddRzdEdbDataList(dataList)
|
|
|
|
|
|
br.Ret = 200
|
|
br.Ret = 200
|
|
br.Success = true
|
|
br.Success = true
|
|
@@ -662,6 +688,20 @@ func (this *BaseFromRzdController) UpdateRzdEdbData() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 同步更新指标库数据
|
|
|
|
+ edbInfo, err := models.GetEdbInfoByEdbCode(utils.DATA_SOURCE_RZD, req.IndexCode)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "指标不存在!"
|
|
|
|
+ br.ErrMsg = "指标不存在"
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if edbInfo.EdbInfoId > 0 {
|
|
|
|
+ err = models.UpdateRzdEdbDataByIndexCodeAndDataTime(req.BaseFromRzdIndexId, req.DataTime, req.Value)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
br.Ret = 200
|
|
br.Ret = 200
|
|
br.Success = true
|
|
br.Success = true
|
|
br.Msg = "处理成功"
|
|
br.Msg = "处理成功"
|