|
@@ -550,8 +550,8 @@ func (this *EdbSourceStatController) EdbUpdateStat() {
|
|
|
total, err := data_stat.GetEdbUpdateStatCount(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
|
|
@@ -757,8 +757,8 @@ func (this *EdbSourceStatController) EdbSourceStat() {
|
|
|
}
|
|
|
|
|
|
// EdbUpdateFailedList
|
|
|
-// @Title 查询指标更新失败详情列表
|
|
|
-// @Description 查询指标更新失败详情列表
|
|
|
+// @Title 查询指标更新失败详情汇总列表
|
|
|
+// @Description 查询指标更新失败详情汇总列表
|
|
|
// @Success 200 {object} data_stat.GetEdbUpdateLogResp
|
|
|
// @router /edb_update_stat/failed [get]
|
|
|
func (this *EdbSourceStatController) EdbUpdateFailedList() {
|
|
@@ -840,3 +840,143 @@ func (this *EdbSourceStatController) EdbUpdateFailedList() {
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+// EdbUpdateFailedDetailList
|
|
|
+// @Title 查询指标更新失败详情列表
|
|
|
+// @Description 查询指标更新失败详情列表
|
|
|
+// @Success 200 {object} data_stat.GetEdbUpdateLogResp
|
|
|
+// @router /edb_update_stat/failed/detail [get]
|
|
|
+func (this *EdbSourceStatController) EdbUpdateFailedDetailList() {
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
+
|
|
|
+ var startSize int
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize20
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+
|
|
|
+ startSize = paging.StartIndex(currentIndex, pageSize)
|
|
|
+
|
|
|
+ terminalCode := this.GetString("TerminalCode", "")
|
|
|
+ createTime := this.GetString("CreateTime", "")
|
|
|
+ frequency := this.GetString("Frequency", "")
|
|
|
+ sourceUpdateFailedReason := this.GetString("SourceUpdateFailedReason", "")
|
|
|
+
|
|
|
+ if createTime == "" {
|
|
|
+ br.Msg = "请选择创建时间"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if terminalCode == "" {
|
|
|
+ br.Msg = "请选择对应的终端信息"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if frequency == "" {
|
|
|
+ br.Msg = "请选择对应的频度"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ condition := " and source = ? and terminal_code = ? and frequency=? and data_update_failed_reason=? and data_update_result = 2"
|
|
|
+ var pars []interface{}
|
|
|
+ pars = append(pars, utils.DATA_SOURCE_MYSTEEL_CHEMICAL, terminalCode, frequency, sourceUpdateFailedReason)
|
|
|
+
|
|
|
+ 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))
|
|
|
+ }
|
|
|
+
|
|
|
+ total, err := data_stat.GetEdbUpdateStatCount(condition, pars)
|
|
|
+ if err != nil {
|
|
|
+ if err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取指标列表总数失败"
|
|
|
+ br.ErrMsg = "获取指标列表总数失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ err = nil
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list := make([]*data_stat.EdbInfoUpdateStatItem, 0)
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
+ if total == 0 {
|
|
|
+ resp := data_stat.GetEdbUpdateStatResp{
|
|
|
+ Paging: page,
|
|
|
+ List: list,
|
|
|
+ }
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+ return
|
|
|
+ }
|
|
|
+ tmpList, err := data_stat.GetEdbUpdateStatByCondition(condition, pars, "", pageSize, startSize)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取指标更新列表失败"
|
|
|
+ br.ErrMsg = "获取指标更新列表失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range tmpList {
|
|
|
+ tmp := new(data_stat.EdbInfoUpdateStatItem)
|
|
|
+ tmp.Id = v.Id
|
|
|
+ tmp.EdbInfoId = v.EdbInfoId
|
|
|
+ tmp.SourceName = v.SourceName
|
|
|
+ tmp.Source = v.Source
|
|
|
+ tmp.EdbCode = v.EdbCode
|
|
|
+ tmp.EdbName = v.EdbName
|
|
|
+ tmp.EdbNameSource = v.EdbNameSource
|
|
|
+ tmp.Frequency = v.Frequency
|
|
|
+ tmp.Unit = v.Unit
|
|
|
+ tmp.StartDate = v.StartDate
|
|
|
+ tmp.SysUserId = v.SysUserId
|
|
|
+ tmp.SysUserRealName = v.SysUserRealName
|
|
|
+ tmp.LatestDate = v.LatestDate
|
|
|
+ tmp.LatestValue = v.LatestValue
|
|
|
+ tmp.TerminalCode = v.TerminalCode
|
|
|
+ tmp.CreateTime = v.CreateTime.Format(utils.FormatDateTime)
|
|
|
+ if v.DataUpdateTime != utils.EmptyDateTimeStr {
|
|
|
+ tmp.DataUpdateTime = v.DataUpdateTime
|
|
|
+ }
|
|
|
+ if v.ErDataUpdateDate != utils.EmptyDateStr {
|
|
|
+ tmp.ErDataUpdateDate = v.ErDataUpdateDate
|
|
|
+ }
|
|
|
+ tmp.DataUpdateResult = v.DataUpdateResult
|
|
|
+ tmp.DataUpdateFailedReason = v.DataUpdateFailedReason
|
|
|
+ if v.UpdateTime != utils.EmptyDateTimeStr {
|
|
|
+ tmp.UpdateTime = v.UpdateTime
|
|
|
+ }
|
|
|
+ tmp.IsAdd = v.IsAdd
|
|
|
+ tmp.NeedRefresh = v.NeedRefresh
|
|
|
+ tmp.HasRefresh = v.HasRefresh
|
|
|
+ list = append(list, tmp)
|
|
|
+ }
|
|
|
+
|
|
|
+ resp := data_stat.GetEdbUpdateStatResp{
|
|
|
+ Paging: page,
|
|
|
+ List: list,
|
|
|
+ }
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|