|
@@ -4,6 +4,7 @@ import (
|
|
|
"encoding/json"
|
|
|
"eta/eta_api/controllers"
|
|
|
"eta/eta_api/models"
|
|
|
+ "eta/eta_api/models/data_manage"
|
|
|
"eta/eta_api/models/data_stat"
|
|
|
"eta/eta_api/utils"
|
|
|
"fmt"
|
|
@@ -691,8 +692,8 @@ func (this *EdbSourceStatController) EdbSourceStat() {
|
|
|
total, err := data_stat.GetEdbSourceStatCount(condition, pars)
|
|
|
if err != nil {
|
|
|
if err.Error() != utils.ErrNoRow() {
|
|
|
- br.Msg = "获取指标删除列表总数失败"
|
|
|
- br.ErrMsg = "获取指标删除列表总数失败,Err:" + err.Error()
|
|
|
+ br.Msg = "获取数据源统计列表总数失败"
|
|
|
+ br.ErrMsg = "获取数据源统计列表总数失败,Err:" + err.Error()
|
|
|
return
|
|
|
} else {
|
|
|
err = nil
|
|
@@ -743,3 +744,88 @@ func (this *EdbSourceStatController) EdbSourceStat() {
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+// EdbUpdateFailedList
|
|
|
+// @Title 查询指标刷新失败详情列表
|
|
|
+// @Description 查询指标刷新失败详情列表
|
|
|
+// @Success 200 {object} data_stat.GetEdbUpdateLogResp
|
|
|
+// @router /edb_update_stat/failed [get]
|
|
|
+func (this *EdbSourceStatController) EdbUpdateFailedList() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ sysUser := this.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ terminalCode := this.GetString("TerminalCode", "")
|
|
|
+ createTime := this.GetString("CreateTime", "")
|
|
|
+
|
|
|
+ if terminalCode == "" {
|
|
|
+ br.Msg = "请选择对应的终端信息"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ terminalInfo, err := data_manage.GetEdbTerminalByTerminalCode(terminalCode)
|
|
|
+ if err != nil {
|
|
|
+ if err.Error() == utils.ErrNoRow() {
|
|
|
+ br.Msg = "终端不存在"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "查询终端信息出错"
|
|
|
+ br.ErrMsg = "查询终端信息出错 Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ condition := " and source = ? and terminal_code = ?"
|
|
|
+ var pars []interface{}
|
|
|
+ pars = append(pars, utils.DATA_SOURCE_MYSTEEL_CHEMICAL, terminalCode)
|
|
|
+
|
|
|
+ if createTime != "" {
|
|
|
+ startT, err := time.ParseInLocation(utils.FormatDate, createTime, time.Local)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "请求时间格式错误"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ endT := startT.AddDate(0, 0, 1)
|
|
|
+ condition += " AND create_time >= ? AND create_time < ?"
|
|
|
+ pars = append(pars, createTime, endT.Format(utils.FormatDate))
|
|
|
+ }
|
|
|
+
|
|
|
+ tmpList, err := data_stat.GetEdbUpdateStatFailedGroupByCondition(condition, pars)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取指标更新失败详情列表 失败"
|
|
|
+ br.ErrMsg = "获取指标更新失败详情列表 失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ list := make([]*data_stat.EdbUpdateFailedList, 0)
|
|
|
+ successNum := 0
|
|
|
+ failedNum := 0
|
|
|
+ if len(tmpList) > 0 {
|
|
|
+ for _, v := range tmpList {
|
|
|
+ if v.SourceUpdateResult == 1 {
|
|
|
+ successNum += v.Num
|
|
|
+ } else {
|
|
|
+ failedNum += v.Num
|
|
|
+ list = append(list, v)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ resp := data_stat.GetEdbUpdateFailedResp{
|
|
|
+ List: list,
|
|
|
+ Name: terminalInfo.Name,
|
|
|
+ TerminalCode: terminalCode,
|
|
|
+ DirPath: terminalInfo.DirPath,
|
|
|
+ UpdateSuccessNum: successNum,
|
|
|
+ UpdateFailedNum: failedNum,
|
|
|
+ }
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|