package data_manage import ( "encoding/json" "eta/eta_api/models" "eta/eta_api/models/data_manage" "eta/eta_api/models/system" "eta/eta_api/services/data" "eta/eta_api/services/data_stat" etaTrialService "eta/eta_api/services/eta_trial" "eta/eta_api/utils" "fmt" "os" "path/filepath" "strconv" "strings" "time" "github.com/rdlucklib/rdluck_tools/paging" "github.com/tealeg/xlsx" ) // EiaSteoClassify // @Title EiaSteo数据分类 // @Description EiaSteo数据分类接口 // @Success 200 {object} data_manage.LzClassify // @router /eia_steo/classify [get] func (this *EdbInfoController) EiaSteoClassify() { 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 } classifyList, err := data_manage.GetEiaSteoClassifyList() if err != nil { br.Msg = "获取分类失败" br.ErrMsg = "获取分类失败,Err:" + err.Error() return } childClassifyMap := make(map[int][]*data_manage.BaseFromEiaSteoClassifyView) rootList := make([]*data_manage.BaseFromEiaSteoClassifyView, 0) for _, v := range classifyList { if v.Level == 1 { rootList = append(rootList, v) } else { childClassifyMap[v.ParentId] = append(childClassifyMap[v.ParentId], v) } } for _, v := range rootList { if existItems, ok := childClassifyMap[v.BaseFromEiaSteoClassifyId]; ok { v.Child = existItems } } br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = rootList } // EiaSteoData // @Title 获取EiaSteo数据 // @Description 获取EiaSteo数据接口 // @Param BaseFromEiaSteoClassifyId query int true "指标分类id" // @Param IndexCode query string true "指标code" // @Param IsExport query bool false "是否导出excel,默认是false" // @Param PageSize query int true "每页数据条数" // @Param CurrentIndex query int true "当前页页码,从1开始" // @Success 200 {object} data_manage.LzFrequency // @router /eia_steo/data [get] func (this *EdbInfoController) EiaSteoData() { 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 //是否导出报表 isExport, _ := this.GetBool("IsExport") if isExport { pageSize = 10000 currentIndex = 1 } if pageSize <= 0 { pageSize = utils.PageSize20 } if currentIndex <= 0 { currentIndex = 1 } startSize = utils.StartIndex(currentIndex, pageSize) var condition string var pars []interface{} indexCode := this.GetString("IndexCode") if indexCode != "" { condition += ` AND index_code = ? ` pars = append(pars, utils.TrimStr(indexCode)) } classifyId, _ := this.GetInt("BaseFromEiaSteoClassifyId") if classifyId > 0 { classifyList, err := data.GetClassifyALLById(classifyId) if err != nil { br.Msg = "获取数据失败" br.ErrMsg = "获取分类数据失败,Err:" + err.Error() return } var classifyIds []int for _, v := range classifyList { classifyIds = append(classifyIds, v.BaseFromEiaSteoClassifyId) } condition += ` AND base_from_eia_steo_classify_id IN (` + utils.GetOrmInReplace(len(classifyIds)) + `) ` pars = append(pars, classifyIds) } //获取指标 indexList, err := data_manage.GetEiaSteoIndexList(condition, pars) if err != nil { br.Msg = "获取数据失败" br.ErrMsg = "获取数据失败,Err:" + err.Error() return } indexCodes := make([]string, 0) for _, v := range indexList { indexCodes = append(indexCodes, v.IndexCode) } edbinfoList, err := data_manage.GetEdbInfoByEdbCodeList(utils.DATA_SOURCE_EIA_STEO, indexCodes) if err != nil { br.Msg = "获取数据失败" br.ErrMsg = "获取数据失败,Err:" + err.Error() return } existEdbInfo := make(map[string]int) for _, v := range edbinfoList { existEdbInfo[v.EdbCode] = v.EdbInfoId } resultList := make([]data_manage.EiaSteoIndexListResp, 0) for _, v := range indexList { indexName := v.IndexName if indexName == `` { indexName = v.IndexNameOriginal } product := data_manage.EiaSteoIndexListResp{ BaseFromEiaSteoIndexId: v.BaseFromEiaSteoIndexId, BaseFromEiaSteoClassifyId: v.BaseFromEiaSteoClassifyId, IndexCode: v.IndexCode, IndexName: indexName, //IndexNameOriginal: v.IndexNameOriginal, EdbInfoId: existEdbInfo[v.IndexCode], Unit: v.Unit, Frequency: v.Frequency, StartDate: v.StartDate.Format(utils.FormatDate), EndDate: v.EndDate.Format(utils.FormatDate), ModifyTime: v.ModifyTime.Format(utils.FormatDateTime), CreateTime: v.CreateTime.Format(utils.FormatDateTime), //Paging: tmpPaging, //DataList: nil, } total, err := data_manage.GetEiaSteoIndexDataCount(v.IndexCode) if err != nil { br.Msg = "获取数据失败" br.ErrMsg = "获取指标统计数据失败,Err:" + err.Error() return } page := paging.GetPaging(currentIndex, pageSize, total) dataList, err := data_manage.GetEiaSteoIndexDataList(v.IndexCode, startSize, pageSize) if err != nil { br.Msg = "获取数据失败" br.ErrMsg = "获取指标数据失败,Err:" + err.Error() return } if dataList == nil { dataList = make([]*data_manage.BaseFromEiaSteoDataItem, 0) } product.DataList = dataList product.Paging = page resultList = append(resultList, product) } //导出excel if isExport { EiaSteoDataExport(this, resultList, br) return } br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = resultList } // EiaSteoSearchList // @Title EiaSteo模糊搜索 // @Description EiaSteo模糊搜索 // @Param Keyword query string ture "关键字搜索" // @Success 200 {object} models.BaseResponse // @router /eia_steo/search_list [get] func (this *EdbInfoController) EiaSteoSearchList() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() sysUser := this.SysUser if sysUser == nil { br.Msg = "请重新登录" return } //关键字 keyword := this.GetString("Keyword") list, err := data_manage.GetEiaSteoItemList(utils.TrimStr(keyword)) if err != nil { br.ErrMsg = "获取失败,Err:" + err.Error() br.Msg = "获取失败" return } br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = list } // EiaSteoDataExport 表格导出 func EiaSteoDataExport(this *EdbInfoController, list []data_manage.EiaSteoIndexListResp, br *models.BaseResponse) { sysUser := this.SysUser if sysUser == nil { br.Msg = "请重新登录" return } dir, _ := os.Executable() exPath := filepath.Dir(dir) downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx" xlsxFile := xlsx.NewFile() sheet, err := xlsxFile.AddSheet("数据报表") //获取指标数据 rowSecName := sheet.AddRow() celSecName := rowSecName.AddCell() celSecName.SetValue("指标名称/Metric Name") frequency := sheet.AddRow() freqCell := frequency.AddCell() freqCell.SetValue("频度/Frequency") rowUnit := sheet.AddRow() celUnit := rowUnit.AddCell() celUnit.SetValue("单位/Unit") rowModifyDate := sheet.AddRow() rowModifyCell := rowModifyDate.AddCell() rowModifyCell.SetValue("更新时间/Update Time") dataMap := make(map[string]map[string]*data_manage.BaseFromEiaSteoDataItem) var indexCodeList []string for _, v := range list { cellSenName := rowSecName.AddCell() cellSenName.SetValue(v.IndexName) freqCell := frequency.AddCell() freqCell.SetValue(v.Frequency) celUnit := rowUnit.AddCell() celUnit.SetValue(v.Unit) rowModifyCell := rowModifyDate.AddCell() rowModifyCell.SetValue(v.ModifyTime) indexCodeList = append(indexCodeList, v.IndexCode) dataMap[v.IndexCode] = make(map[string]*data_manage.BaseFromEiaSteoDataItem) for _, item := range v.DataList { dataMap[item.IndexCode][item.DataTime] = item } } dateList, err := data_manage.GetEiaSteoDateList(indexCodeList) if err != nil { br.Msg = "获取数据失败" br.ErrMsg = "获取数据失败,Err:" + err.Error() return } for _, n := range dateList { dateStr := n.DataTime //当前日期 rowData := sheet.AddRow() celDate := rowData.AddCell() celDate.SetValue(dateStr) for _, m := range list { celData := rowData.AddCell() if dataMap[m.IndexCode][dateStr] != nil { celData.SetValue(dataMap[m.IndexCode][dateStr].Value) } } } err = xlsxFile.Save(downLoadnFilePath) if err != nil { //有指标无数据时先导出一遍空表 sheet, err := xlsxFile.AddSheet("无数据") if err != nil { br.Msg = "新增Sheet失败" br.ErrMsg = "新增Sheet失败,Err:" + err.Error() return } rowSecName := sheet.AddRow() celSecName := rowSecName.AddCell() celSecName.SetValue("") err = xlsxFile.Save(downLoadnFilePath) if err != nil { br.Msg = "保存文件失败" br.ErrMsg = "保存文件失败" return } } fileName := `EiaSteo数据` fileName += time.Now().Format("06.01.02") + `.xlsx` //文件名称 this.Ctx.Output.Download(downLoadnFilePath, fileName) defer func() { os.Remove(downLoadnFilePath) }() br.Ret = 200 br.Success = true br.Msg = "success" } // EiaSteoBatchSearch // @Title EiaSteo批量操作查询接口 // @Description EiaSteo批量操作查询接口 // @Param BaseFromEiaSteoClassifyIds query string true "分类id" // @Param Keyword query string true "名称关键词" // @Success 200 {object} data_manage.LzFrequency // @router /eia_steo/batch_search [get] func (this *EdbInfoController) EiaSteoBatchSearch() { 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 } classifyIdStr := this.GetString("BaseFromEiaSteoClassifyIds") var condition string var pars []interface{} classifyIds := strings.Split(classifyIdStr, ",") if len(classifyIds) > 0 && classifyIds[0] != `` { condition += " AND base_from_eia_steo_classify_id IN (" + utils.GetOrmInReplace(len(classifyIds)) + " ) " pars = append(pars, classifyIds) } keyword := this.GetString("Keyword") if keyword != `` { condition += " AND (index_name like ? OR index_code like ?) " pars = utils.GetLikeKeywordPars(pars, keyword, 2) } if classifyIdStr == `` && keyword == `` { var list = make([]*data_manage.BaseFromEiaSteoIndex, 0) br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = list return } list, err := data_manage.GetEiaSteoIndexList(condition, pars) if err != nil { br.Msg = "获取失败" br.ErrMsg = "获取失败,Err:" + err.Error() return } br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = list } // AddCheck // @Title 新增校验 // @Description 新增校验 // @Param request body request.BusinessDataBatchAddCheckReq true "type json string" // @Success 200 string "操作成功" // @router /eia_steo/edb_info/add_check [post] func (c *EdbInfoController) EiaSteoAddCheck() { br := new(models.BaseResponse).Init() defer func() { if br.ErrMsg == "" { br.IsSendEmail = false } c.Data["json"] = br c.ServeJSON() }() sysUser := c.SysUser if sysUser == nil { br.Msg = "请登录" br.ErrMsg = "请登录,SysUser Is Empty" br.Ret = 408 return } var req data_manage.EiaSteoDataBatchAddCheckReq if e := json.Unmarshal(c.Ctx.Input.RequestBody, &req); e != nil { br.Msg = "参数解析异常!" br.ErrMsg = "参数解析失败,Err:" + e.Error() return } codeMax := 30 codeLen := len(req.IndexCodes) if codeLen == 0 { br.Msg = "请选择指标" return } if codeLen > codeMax { br.Msg = fmt.Sprintf("最多只能选择%d个指标", codeMax) return } // 获取指标库已有指标 existsEdb, e := data_manage.GetEdbCodesBySource(utils.DATA_SOURCE_EIA_STEO) if e != nil { br.Msg = "获取失败" br.ErrMsg = "获取自有数据已添加的指标失败, Err: " + e.Error() return } existMap := make(map[string]*data_manage.EdbInfo) for _, v := range existsEdb { existMap[v.EdbCode] = v } // 查询选中的指标 cond := fmt.Sprintf(` AND index_code IN (%s) `, utils.GetOrmInReplace(len(req.IndexCodes))) pars := make([]interface{}, 0) pars = append(pars, req.IndexCodes) list, err := data_manage.GetEiaSteoIndexList(cond, pars) if err != nil { br.Msg = "获取失败" br.ErrMsg = "获取eiaSteo原始指标列表失败, Err: " + err.Error() return } resp := make([]*data_manage.BaseFromEiaSteoIndexItem, 0) for _, v := range list { if edbInfo, ok := existMap[v.IndexCode]; ok { resp = append(resp, &data_manage.BaseFromEiaSteoIndexItem{ BaseFromEiaSteoIndexId: v.BaseFromEiaSteoIndexId, BaseFromEiaSteoClassifyId: v.BaseFromEiaSteoClassifyId, IndexCode: v.IndexCode, IndexName: v.IndexName, EdbInfoId: edbInfo.EdbInfoId, EdbUniqueCode: edbInfo.UniqueCode, EdbClassifyId: edbInfo.ClassifyId, EdbExist: 1, }) } else { resp = append(resp, &data_manage.BaseFromEiaSteoIndexItem{ BaseFromEiaSteoIndexId: v.BaseFromEiaSteoIndexId, BaseFromEiaSteoClassifyId: v.BaseFromEiaSteoClassifyId, IndexCode: v.IndexCode, IndexName: v.IndexName, EdbInfoId: 0, EdbUniqueCode: "", EdbClassifyId: 0, EdbExist: 0, }) } } br.Data = resp br.Msg = "校验成功" br.Ret = 200 br.Success = true } // EiaSteoNameCheck // @Title 重名校验 // @Description 批量新增 // @Param request body data_manage.AddEdbInfoReq true "type json string" // @Success 200 string "操作成功" // @router /eia_steo/name_check [post] func (c *EdbInfoController) EiaSteoNameCheck() { br := new(models.BaseResponse).Init() defer func() { if br.ErrMsg == "" { br.IsSendEmail = false } c.Data["json"] = br c.ServeJSON() }() sysUser := c.SysUser if sysUser == nil { br.Msg = "请登录" br.ErrMsg = "请登录,SysUser Is Empty" br.Ret = 408 return } var req []*data_manage.NameCheckEdbInfoReq if e := json.Unmarshal(c.Ctx.Input.RequestBody, &req); e != nil { br.Msg = "参数解析异常!" br.ErrMsg = "参数解析失败,Err:" + e.Error() return } if len(req) == 0 { br.Msg = "请选择指标" return } codeMax := 30 codeLen := len(req) if codeLen > codeMax { br.Msg = fmt.Sprintf("最多只能选择%d个指标", codeMax) return } type NameCheckResult struct { EdbCode string EdbName string Exist bool } indexNames := make([]string, 0) resp := make([]*NameCheckResult, 0) for _, v := range req { v.EdbCode = strings.TrimSpace(v.EdbCode) if v.EdbCode == "" { br.Msg = "指标ID不可为空" return } v.EdbName = strings.TrimSpace(v.EdbName) if v.EdbName == "" { br.Msg = "请输入指标名称" return } indexNames = append(indexNames, v.EdbName) resp = append(resp, &NameCheckResult{ EdbCode: v.EdbCode, EdbName: v.EdbName, }) dataItems, err := data_manage.GetEdbDataAllByEdbCode(v.EdbCode, utils.DATA_SOURCE_EIA_STEO, 0, utils.EDB_DATA_LIMIT) if err != nil && err.Error() != utils.ErrNoRow() { br.Msg = "获取失败" br.ErrMsg = "获取钢联已存在信息失败,Err:" + err.Error() return } if len(dataItems) <= 0 { respItem, err := data.AddEdbData(utils.DATA_SOURCE_EIA_STEO, v.EdbCode, v.Frequency) if err != nil { br.Msg = "获取失败" br.ErrMsg = "获取失败,Err:" + err.Error() return } if respItem.Ret != 200 { br.Msg = "未搜索到该指标" br.ErrMsg = respItem.ErrMsg + ";EdbCode:" + v.EdbCode return } } } // 重名校验 edbList, e := data_manage.GetEdbInfoByNameArr(indexNames, utils.EDB_INFO_TYPE) if e != nil { br.Msg = "操作失败" br.ErrMsg = "获取重名指标失败, Err: " + e.Error() return } nameExists := make(map[string]bool) for _, v := range edbList { nameExists[v.EdbName] = true } if len(nameExists) > 0 { for _, v := range resp { v.Exist = nameExists[v.EdbName] } } br.Data = resp br.Msg = "校验成功" br.Ret = 200 br.Success = true } // EiaSteoBatchAdd // @Title eiaSteo批量新增 // @Description eiaSteo批量新增 // @Param request body data_manage.AddEdbInfoReq true "type json string" // @Success 200 string "操作成功" // @router /eia_steo/batch_add [post] func (this *EdbInfoController) EiaSteoBatchAdd() { br := new(models.BaseResponse).Init() defer func() { if br.ErrMsg == "" { br.IsSendEmail = false } this.Data["json"] = br this.ServeJSON() }() sysUser := this.SysUser if sysUser == nil { br.Msg = "请登录" br.ErrMsg = "请登录,SysUser Is Empty" br.Ret = 408 return } deleteCache := true cacheKey := "CACHE_EDB_INFO_BATCH_ADD_EIA_STEO_" + strconv.Itoa(sysUser.AdminId) defer func() { if deleteCache { _ = utils.Rc.Delete(cacheKey) } }() if !utils.Rc.SetNX(cacheKey, 1, 30*time.Second) { deleteCache = false br.Msg = "系统处理中,请稍后重试!" br.ErrMsg = "系统处理中,请稍后重试!" + sysUser.RealName + ";data:" + string(this.Ctx.Input.RequestBody) return } var req []*data_manage.AddEdbInfoReq if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil { br.Msg = "参数解析异常!" br.ErrMsg = "参数解析失败,Err:" + e.Error() return } if len(req) == 0 { br.Msg = "请选择指标" return } if len(req) > 30 { br.Msg = "批量添加指标数量不得超过30个" return } for _, v := range req { v.EdbCode = strings.TrimSpace(v.EdbCode) if v.EdbCode == "" { br.Msg = "指标ID不可为空" return } v.EdbName = strings.TrimSpace(v.EdbName) if v.EdbName == "" { br.Msg = "请输入指标名称" return } v.Frequency = strings.TrimSpace(v.Frequency) if v.Frequency == "" { br.Msg = "请选择频度" return } v.Unit = strings.TrimSpace(v.Unit) if v.Unit == "" { br.Msg = "请输入单位" return } if v.ClassifyId <= 0 { br.Msg = "请选择分类" return } } // 限定同一时间最多批量新增30个指标 for _, v := range req { var r data.EiaSteoIndexSource2EdbReq r.EdbCode = v.EdbCode r.EdbName = v.EdbName r.Frequency = v.Frequency r.Unit = v.Unit r.ClassifyId = v.ClassifyId r.AdminId = sysUser.AdminId r.AdminRealName = sysUser.RealName edbInfo, e, errMsg, skip := data.EiaSteoIndexSource2Edb(r, this.Lang) if e != nil { br.Msg = "操作失败" if errMsg != "" { br.Msg = errMsg } br.ErrMsg = e.Error() return } if skip { continue } // 试用平台更新用户累计新增指标数 if utils.BusinessCode == utils.BusinessCodeSandbox { go func() { adminItem, e := system.GetSysAdminById(sysUser.AdminId) if e != nil { tips := fmt.Sprintf("试用平台更新用户累计新增指标数-获取用户失败, Err: " + e.Error()) utils.FileLog.Info(tips) return } if adminItem.DepartmentName != "ETA试用客户" { return } var ur etaTrialService.EtaTrialUserReq ur.Mobile = adminItem.Mobile _, _ = etaTrialService.UpdateUserIndexNum(ur) }() } // 新增操作日志 { edbLog := new(data_manage.EdbInfoLog) edbLog.EdbInfoId = edbInfo.EdbInfoId edbLog.SourceName = edbInfo.SourceName edbLog.Source = edbInfo.Source edbLog.EdbCode = edbInfo.EdbCode edbLog.EdbName = edbInfo.EdbName edbLog.ClassifyId = edbInfo.ClassifyId edbLog.SysUserId = sysUser.AdminId edbLog.SysUserRealName = sysUser.RealName edbLog.CreateTime = time.Now() edbLog.Content = string(this.Ctx.Input.RequestBody) edbLog.Status = "新增指标" edbLog.Method = this.Ctx.Input.URI() go data_manage.AddEdbInfoLog(edbLog) } } br.Msg = "操作成功" br.Ret = 200 br.Success = true br.IsAddLog = true } // EiaSteoAdd // @Title 新增eiaSteo指标接口 // @Description 新增eiaSteo指标接口 // @Param request body data_manage.AddEdbInfoReq true "type json string" // @Success Ret=200 保存成功 // @router /eia_steo/edb_info/add [post] func (this *EdbInfoController) EiaSteoAdd() { 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 } deleteCache := true cacheKey := "CACHE_EDB_INFO_ADD_" + strconv.Itoa(sysUser.AdminId) defer func() { if deleteCache { utils.Rc.Delete(cacheKey) } }() if !utils.Rc.SetNX(cacheKey, 1, 30*time.Second) { deleteCache = false br.Msg = "系统处理中,请稍后重试!" br.ErrMsg = "系统处理中,请稍后重试!" + sysUser.RealName + ";data:" + string(this.Ctx.Input.RequestBody) return } var req data_manage.AddEdbInfoReq err := json.Unmarshal(this.Ctx.Input.RequestBody, &req) if err != nil { br.Msg = "参数解析异常!" br.ErrMsg = "参数解析失败,Err:" + err.Error() return } req.EdbName = strings.Trim(req.EdbName, " ") req.EdbCode = strings.Trim(req.EdbCode, " ") if req.EdbCode == "" { br.Msg = "指标ID不能为空" return } if req.EdbName == "" { br.Msg = "指标名称不能为空" return } if req.Frequency == "" { br.Msg = "频率不能为空" return } if req.Unit == "" { br.Msg = "单位不能为空" return } if req.ClassifyId <= 0 { br.Msg = "请选择分类" return } tmpInfo, err := data_manage.GetBaseFromEiaSteoIndexByCode(req.EdbCode) if err != nil { if err.Error() != utils.ErrNoRow() { br.Msg = "获取失败" br.ErrMsg = "获取失败,Err:" + err.Error() return } } var source int if tmpInfo != nil { source = utils.DATA_SOURCE_EIA_STEO } else { br.Msg = "指标不存在" return } // 指标入库 edbInfo, err, errMsg, isSendEmail := data.EdbInfoAdd(source, utils.DATA_SUB_SOURCE_EDB, req.ClassifyId, req.EdbCode, req.EdbName, req.Frequency, req.Unit, req.StartDate, req.EndDate, sysUser.AdminId, sysUser.RealName, this.Lang) if err != nil { br.Msg = "保存失败" if errMsg != `` { br.Msg = errMsg } br.ErrMsg = err.Error() br.IsSendEmail = isSendEmail return } // 试用平台更新用户累计新增指标数 adminItem, e := system.GetSysAdminById(sysUser.AdminId) if e != nil { br.Msg = "操作失败" br.ErrMsg = "获取系统用户数据失败,Err:" + e.Error() return } if utils.BusinessCode == utils.BusinessCodeSandbox && adminItem.DepartmentName == "ETA试用客户" { go func() { var r etaTrialService.EtaTrialUserReq r.Mobile = adminItem.Mobile _, _ = etaTrialService.UpdateUserIndexNum(r) }() } //新增操作日志 { // 添加钢联指标更新日志 if edbInfo.Source == utils.DATA_SOURCE_MYSTEEL_CHEMICAL { go data_stat.AddEdbInfoUpdateLog(edbInfo.EdbInfoId, 1, "", sysUser, 2) } edbLog := new(data_manage.EdbInfoLog) edbLog.EdbInfoId = edbInfo.EdbInfoId edbLog.SourceName = edbInfo.SourceName edbLog.Source = edbInfo.Source edbLog.EdbCode = edbInfo.EdbCode edbLog.EdbName = edbInfo.EdbName edbLog.ClassifyId = edbInfo.ClassifyId edbLog.SysUserId = sysUser.AdminId edbLog.SysUserRealName = sysUser.RealName edbLog.CreateTime = time.Now() edbLog.Content = string(this.Ctx.Input.RequestBody) edbLog.Status = "新增指标" edbLog.Method = this.Ctx.Input.URI() go data_manage.AddEdbInfoLog(edbLog) } // 更新es go data.AddOrEditEdbInfoToEs(edbInfo.EdbInfoId) resp := new(data_manage.AddEdbInfoResp) resp.EdbInfoId = edbInfo.EdbInfoId resp.UniqueCode = edbInfo.UniqueCode resp.ClassifyId = edbInfo.ClassifyId br.Ret = 200 br.Success = true br.Msg = "保存成功" br.Data = resp br.IsAddLog = true }