浏览代码

合并冲突

kobe6258 3 周之前
父节点
当前提交
9dd3039f0b
共有 100 个文件被更改,包括 1276 次插入1103 次删除
  1. 4 4
      controllers/ai/ai.go
  2. 3 3
      controllers/ai/ai_file.go
  3. 4 4
      controllers/ai/ai_pormpt.go
  4. 18 18
      controllers/ai/ai_summary.go
  5. 2 2
      controllers/base_auth.go
  6. 7 7
      controllers/bi_dashboard.go
  7. 2 2
      controllers/business_conf.go
  8. 4 3
      controllers/classify.go
  9. 4 4
      controllers/cloud_disk.go
  10. 2 2
      controllers/commodity_trade_base_index.go
  11. 4 4
      controllers/company_seller.go
  12. 4 4
      controllers/data_manage/ai_predict_model/classify.go
  13. 14 14
      controllers/data_manage/ai_predict_model/framework.go
  14. 7 7
      controllers/data_manage/ai_predict_model/index.go
  15. 5 5
      controllers/data_manage/baiinfo_data.go
  16. 3 2
      controllers/data_manage/base_from_ly_index_controller.go
  17. 1 1
      controllers/data_manage/base_from_rzd_index_controller.go
  18. 4 4
      controllers/data_manage/base_from_ths_hf.go
  19. 2 2
      controllers/data_manage/base_from_ths_hf_classify.go
  20. 25 24
      controllers/data_manage/bloomberg_data.go
  21. 2 2
      controllers/data_manage/business_data.go
  22. 2 2
      controllers/data_manage/ccf_data.go
  23. 76 49
      controllers/data_manage/chart_classify.go
  24. 1 1
      controllers/data_manage/chart_common.go
  25. 2 2
      controllers/data_manage/chart_edb_config.go
  26. 13 13
      controllers/data_manage/chart_framework.go
  27. 132 54
      controllers/data_manage/chart_info.go
  28. 7 4
      controllers/data_manage/chart_theme.go
  29. 8 8
      controllers/data_manage/clarksons_data.go
  30. 5 5
      controllers/data_manage/com_trade.go
  31. 28 30
      controllers/data_manage/correlation/correlation_chart_classify.go
  32. 28 28
      controllers/data_manage/correlation/correlation_chart_info.go
  33. 22 22
      controllers/data_manage/cross_variety/chart_info.go
  34. 10 10
      controllers/data_manage/cross_variety/classify.go
  35. 3 3
      controllers/data_manage/cross_variety/tag.go
  36. 3 3
      controllers/data_manage/cross_variety/variety.go
  37. 2 2
      controllers/data_manage/data_manage_permission/message.go
  38. 18 18
      controllers/data_manage/edb_classify.go
  39. 116 118
      controllers/data_manage/edb_info.go
  40. 12 7
      controllers/data_manage/edb_info_calculate.go
  41. 11 11
      controllers/data_manage/edb_info_refresh.go
  42. 8 8
      controllers/data_manage/edb_info_relation.go
  43. 2 2
      controllers/data_manage/eia_steo.go
  44. 7 7
      controllers/data_manage/excel/balance_table.go
  45. 9 9
      controllers/data_manage/excel/custom_analysis.go
  46. 1 1
      controllers/data_manage/excel/custom_analysis_edb.go
  47. 15 15
      controllers/data_manage/excel/excel_classify.go
  48. 47 21
      controllers/data_manage/excel/excel_info.go
  49. 2 2
      controllers/data_manage/factor_edb_series.go
  50. 1 1
      controllers/data_manage/fenwei_data.go
  51. 15 0
      controllers/data_manage/fix.go
  52. 12 12
      controllers/data_manage/future_good/future_good_chart_classify.go
  53. 38 38
      controllers/data_manage/future_good/future_good_chart_info.go
  54. 6 6
      controllers/data_manage/future_good/future_good_edb_info.go
  55. 9 9
      controllers/data_manage/future_good/future_good_profit_chart_info.go
  56. 7 7
      controllers/data_manage/gpr_risk_data.go
  57. 12 12
      controllers/data_manage/line_equation/line_chart_classify.go
  58. 21 21
      controllers/data_manage/line_equation/line_chart_info.go
  59. 43 39
      controllers/data_manage/line_feature/chart_info.go
  60. 12 12
      controllers/data_manage/line_feature/classify.go
  61. 11 13
      controllers/data_manage/manual.go
  62. 17 10
      controllers/data_manage/multiple_graph_config.go
  63. 41 45
      controllers/data_manage/my_chart.go
  64. 6 6
      controllers/data_manage/mysteel_chemical_data.go
  65. 3 3
      controllers/data_manage/predict_edb_classify.go
  66. 16 20
      controllers/data_manage/predict_edb_info.go
  67. 12 12
      controllers/data_manage/range_analysis/chart_classify.go
  68. 21 21
      controllers/data_manage/range_analysis/chart_info.go
  69. 5 5
      controllers/data_manage/sci_data.go
  70. 7 7
      controllers/data_manage/sci_hq_data.go
  71. 4 4
      controllers/data_manage/smm_data.go
  72. 7 7
      controllers/data_manage/supply_analysis/variety.go
  73. 6 6
      controllers/data_manage/supply_analysis/variety_edb.go
  74. 8 8
      controllers/data_manage/supply_analysis/variety_plant.go
  75. 6 6
      controllers/data_manage/usda_fas_data.go
  76. 7 7
      controllers/data_manage/wind_data.go
  77. 10 8
      controllers/data_manage/yongyi_data.go
  78. 14 1
      controllers/data_source/data_source.go
  79. 7 8
      controllers/data_source/sci99.go
  80. 25 26
      controllers/data_stat/edb_source_stat.go
  81. 5 3
      controllers/document_manage/document_manage_controller.go
  82. 2 2
      controllers/english_report/email.go
  83. 5 5
      controllers/english_report/en_permission.go
  84. 8 8
      controllers/english_report/english_classify.go
  85. 3 3
      controllers/english_report/english_company.go
  86. 2 2
      controllers/english_report/english_company_todo.go
  87. 5 5
      controllers/english_report/english_video.go
  88. 1 1
      controllers/english_report/policy_report.go
  89. 10 10
      controllers/english_report/report.go
  90. 1 1
      controllers/eta_trial/questionnaire.go
  91. 12 10
      controllers/hisugar_data.go
  92. 16 16
      controllers/material/material.go
  93. 2 5
      controllers/meeting_probabilities.go
  94. 7 8
      controllers/oilchem_data.go
  95. 2 2
      controllers/out_link.go
  96. 10 10
      controllers/ppt_english.go
  97. 18 13
      controllers/ppt_v2.go
  98. 3 3
      controllers/report.go
  99. 36 35
      controllers/report_approve/report_approve.go
  100. 8 8
      controllers/report_approve/report_approve_flow.go

+ 4 - 4
controllers/ai/ai.go

@@ -71,7 +71,7 @@ func (this *AiController) List() {
 	//根据提问,获取信息
 	askUuid := utils.MD5(req.Ask)
 	chatMode, err := aimod.GetAiChatByAsk(askUuid)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取数据失败!"
 		br.ErrMsg = "获取数据失败,GetAiChatByAsk,Err:" + err.Error()
 		return
@@ -88,7 +88,7 @@ func (this *AiController) List() {
 		//获取主题下的所有信息
 		//AiChatTopicId
 		historyList, err := aimod.GetAiChatList(req.AiChatTopicId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取主题历史数据失败!"
 			br.ErrMsg = "获取主题历史数据失败,Err:" + err.Error()
 			return
@@ -317,12 +317,12 @@ func (this *AiController) TopicEdit() {
 		return
 	}
 	topic, err := aimod.GetAiChatTopicByTopicName(req.TopicName)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "编辑失败!"
 		br.ErrMsg = "获取数据失败!Err:" + err.Error()
 		return
 	}
-	if topic != nil && topic.AiChatTopicId != req.AiChatTopicId {
+	if topic != nil && topic.AiChatTopicId != req.AiChatTopicId && topic.AiChatTopicId > 0 {
 		br.Msg = "话题名称已存在,请重新修改!"
 		return
 	}

+ 3 - 3
controllers/ai/ai_file.go

@@ -110,7 +110,7 @@ func (this *AiFileController) FileUpload() {
 		aiChatTopicObj.AiChatTopicId = aiChatTopicId
 		topic, err := aiChatTopicObj.GetAiChatTopicById()
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "获取数据失败!"
 				br.ErrMsg = "获取数据失败,主题不存在,Err:" + err.Error()
 				return
@@ -283,7 +283,7 @@ func (this *AiFileController) FileRetrieve() {
 		aiChatTopicObj.AiChatTopicId = req.AiChatTopicId
 		topic, err := aiChatTopicObj.GetAiChatTopicById()
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "获取数据失败!"
 				br.ErrMsg = "获取数据失败,主题不存在,Err:" + err.Error()
 				return
@@ -301,7 +301,7 @@ func (this *AiFileController) FileRetrieve() {
 	//获取主题下的所有信息
 	//AiChatTopicId
 	historyList, err := aimod.GetAiChatList(req.AiChatTopicId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取主题历史数据失败!"
 		br.ErrMsg = "获取主题历史数据失败,Err:" + err.Error()
 		return

+ 4 - 4
controllers/ai/ai_pormpt.go

@@ -302,7 +302,7 @@ func (this *AiController) MoveAiPrompt() {
 
 	prompt, err := ai_summary.GetAiPromptById(req.AiPromptId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "当前提示词不存在"
 			br.ErrMsg = "当前提示词不存在"
 			return
@@ -321,7 +321,7 @@ func (this *AiController) MoveAiPrompt() {
 	if req.PrevAiPromptId > 0 {
 		prevPrompt, err = ai_summary.GetAiPromptById(req.PrevAiPromptId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				err = errors.New("目录下的提示词不存在")
 				return
 			}
@@ -334,7 +334,7 @@ func (this *AiController) MoveAiPrompt() {
 	if req.NextAiPromptId > 0 {
 		nextPrompt, err = ai_summary.GetAiPromptById(req.NextAiPromptId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				err = errors.New("目录下的提示词不存在")
 				return
 			}
@@ -410,4 +410,4 @@ func (this *AiController) SharePrompt() {
 	br.Msg = "操作成功"
 
 	return
-}
+}

+ 18 - 18
controllers/ai/ai_summary.go

@@ -58,7 +58,7 @@ func (this *AiController) AiSummaryClassifyItems() {
 	}
 
 	rootList, err := ai_summary.GetAiSummaryClassifyAndInfoByParentId(aiSummaryClassifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -68,7 +68,7 @@ func (this *AiController) AiSummaryClassifyItems() {
 	}
 
 	classifyAll, err := ai_summary.GetAiSummaryClassifyAndInfoByParentId(aiSummaryClassifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -243,7 +243,7 @@ func (this *AiController) DeleteSandboxClassifyCheck() {
 
 	if deleteStatus != 1 {
 		classifyCount, err := ai_summary.GetAiSummaryInfoCountByClassifyId(req.AiSummaryClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "分类下是否含有沙盘失败,Err:" + err.Error()
 			return
@@ -304,7 +304,7 @@ func (this *AiController) DeleteAiSummaryClassify() {
 	if req.AiSummaryClassifyId > 0 && req.AiSummaryId == 0 {
 		//判断是否含有纪要
 		count, err := ai_summary.GetAiSummaryInfoCountByClassifyId(req.AiSummaryClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
 			return
@@ -328,7 +328,7 @@ func (this *AiController) DeleteAiSummaryClassify() {
 	if req.AiSummaryId > 0 {
 		summaryInfo, err := ai_summary.GetAiSummaryById(req.AiSummaryId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "纪要已删除,请刷新页面"
 				br.ErrMsg = "指标不存在,Err:" + err.Error()
 				return
@@ -581,7 +581,7 @@ func (this *AiController) AiSummaryClassifyMove() {
 		} else {
 			// prevId为0,也就是沙盘移到最前端
 			firstClassify, err := ai_summary.GetFirstAiSummaryByClassifyId(req.AiSummaryClassifyId)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "移动失败"
 				br.ErrMsg = "获取获取当前父级分类下的排序第一条的分类信息失败,Err:" + err.Error()
 				return
@@ -770,7 +770,7 @@ func (this *AiController) AiSummaryClassifyMove() {
 
 		} else {
 			firstClassify, err := ai_summary.GetFirstAiSummaryClassifyByParentId(aiSummaryClassifyInfo.ParentId)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "移动失败"
 				br.ErrMsg = "获取获取当前父级分类下的排序第一条的分类信息失败,Err:" + err.Error()
 				return
@@ -849,7 +849,7 @@ func (this *AiController) AiSummaryList() {
 
 	if aiSummaryClassifyId > 0 {
 		sandboxClassifyIds, err := ai_summary.GetAiSummaryClassify(aiSummaryClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取图表信息失败"
 			br.ErrMsg = "获取信息失败,GetChartClassify,Err:" + err.Error()
 			return
@@ -870,7 +870,7 @@ func (this *AiController) AiSummaryList() {
 
 	//获取图表信息
 	list, err := ai_summary.GetAiSummaryListByCondition(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取纪要信息失败"
 		br.ErrMsg = "获取纪要信息失败,Err:" + err.Error()
@@ -887,7 +887,7 @@ func (this *AiController) AiSummaryList() {
 		list[i].ParentIds = ids
 	}
 	resp := new(ai_summary.AiSummaryListResp)
-	if list == nil || len(list) <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || len(list) <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		items := make([]*ai_summary.AiSummaryItems, 0)
 		resp.Paging = page
 		resp.List = items
@@ -898,7 +898,7 @@ func (this *AiController) AiSummaryList() {
 	}
 
 	dataCount, err := ai_summary.GetAiSummaryListCountByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取指标信息失败"
 		br.ErrMsg = "获取指标数据总数失败,Err:" + err.Error()
 		return
@@ -934,7 +934,7 @@ func (this *AiController) AiSummaryDetail() {
 	aiSummaryId, _ := this.GetInt("AiSummaryId")
 
 	detail, err := ai_summary.GetAiSummaryItemById(aiSummaryId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取沙盘信息失败"
 		br.ErrMsg = "获取沙盘信息失败,Err:" + err.Error()
@@ -948,7 +948,7 @@ func (this *AiController) AiSummaryDetail() {
 		item := new(saModel.SaDoc)
 		e := item.GetItemById(detail.SaDocId)
 		if e != nil {
-			if e.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(e) {
 				br.Msg = "文档已被删除, 请刷新页面"
 				return
 			}
@@ -1137,7 +1137,7 @@ func (this *AiController) GenerateAiSummary() {
 		//获取主题下的所有信息
 		//AiChatTopicId
 		historyList, err := aimod.GetAiChatList(req.AiChatTopicId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取主题历史数据失败!"
 			br.ErrMsg = "获取主题历史数据失败,Err:" + err.Error()
 			return
@@ -1225,7 +1225,7 @@ func (this *AiController) GenerateAiSummary() {
 			aiChatTopicObj.AiChatTopicId = req.AiChatTopicId
 			topic, err := aiChatTopicObj.GetAiChatTopicById()
 			if err != nil {
-				if err.Error() == utils.ErrNoRow() {
+				if utils.IsErrNoRow(err) {
 					br.Msg = "获取数据失败!"
 					br.ErrMsg = "获取数据失败,主题不存在,Err:" + err.Error()
 					return
@@ -1461,7 +1461,7 @@ func (this *AiController) GenerateAiSummary() {
 //		aiChatTopicObj.AiChatTopicId = aiChatTopicId
 //		topic, err := aiChatTopicObj.GetAiChatTopicById()
 //		if err != nil {
-//			if err.Error() == utils.ErrNoRow() {
+//			if utils.IsErrNoRow(err) {
 //				br.Msg = "获取数据失败!"
 //				br.ErrMsg = "获取数据失败,主题不存在,Err:" + err.Error()
 //				return
@@ -1585,14 +1585,14 @@ func (this *AiController) AiSummaryClassifyList() {
 	resp := new(ai_summary.AiSummaryClassifyListResp)
 
 	rootList, err := ai_summary.GetAiSummaryClassifyByParentId(0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	classifyAll, err := ai_summary.GetAiSummaryClassifyAll()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return

+ 2 - 2
controllers/base_auth.go

@@ -119,7 +119,7 @@ func (c *BaseAuthController) Prepare() {
 
 			session, err := system.GetSysSessionByToken(token)
 			if err != nil {
-				if err.Error() == utils.ErrNoRow() {
+				if utils.IsErrNoRow(err) {
 					c.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "Token 信息已变更:Token: " + token}, false, false)
 					c.StopRun()
 					return
@@ -148,7 +148,7 @@ func (c *BaseAuthController) Prepare() {
 			}
 			admin, err := system.GetSysUserById(session.SysUserId)
 			if err != nil {
-				if err.Error() == utils.ErrNoRow() {
+				if utils.IsErrNoRow(err) {
 					c.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "获取admin 信息失败 " + strconv.Itoa(session.SysUserId)}, false, false)
 					c.StopRun()
 					return

+ 7 - 7
controllers/bi_dashboard.go

@@ -70,7 +70,7 @@ func (this *BIDaShboardController) AddDashboard() {
 		return
 	}
 	nameItem, err := bi_dashboard.GetDashboardByName(req.BiDashboardName, this.SysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "查询失败"
 		br.ErrMsg = "查询失败,Err:" + err.Error()
 		return
@@ -151,7 +151,7 @@ func (this *BIDaShboardController) EditDashboard() {
 		br.ErrMsg = "获取数据异常,Err:" + err.Error()
 		return
 	}
-	
+
 	// 修改
 	item.BiDashboardName = req.BiDashboardName
 	item.ModifyTime = time.Now()
@@ -728,7 +728,7 @@ func (this *BIDaShboardController) EditDashboardClassify() {
 		return
 	}
 	item, err := bi_dashboard.GetBiDashboardClassifyById(req.BiDashboardClassifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取数据异常!"
 		br.ErrMsg = "获取数据异常,Err:" + err.Error()
 		return
@@ -1035,7 +1035,7 @@ func (this *BIDaShboardController) PublicCancel() {
 	}
 
 	item, err := bi_dashboard.GetDashboardById(req.BiDashboardId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取数据异常!"
 		br.ErrMsg = "获取数据异常,Err:" + err.Error()
 		return
@@ -1069,7 +1069,7 @@ func (this *BIDaShboardController) HomePage() {
 	}()
 
 	item, err := bi_dashboard.GetBiDashboardHomePageById(this.SysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "数据不存在"
 		br.ErrMsg = "数据不存在,Err:" + err.Error()
 		return
@@ -1127,7 +1127,7 @@ func (this *BIDaShboardController) HomePageSave() {
 	}
 
 	item, err := bi_dashboard.GetBiDashboardHomePageById(this.SysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "首页看板查询失败"
 		br.ErrMsg = "首页看板查询失败,Err:" + err.Error()
 		return
@@ -1257,7 +1257,7 @@ func (this *BIDaShboardController) ChartExcelPermission() {
 	//共享客户组下的用户
 	shareSellerMap := make(map[int]bool, 0)
 	subAdmins, err := system.GetAdminByGroupId(groupId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取销售失败"
 		br.ErrMsg = "获取销售失败,Err:" + err.Error()
 		return

+ 2 - 2
controllers/business_conf.go

@@ -326,7 +326,7 @@ func (this *BusinessConfController) SingleSave() {
 	// 获取配置信息
 	confOb, e := models.GetBusinessConfByKey(req.ConfKey)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "配置不存在"
 			return
 		}
@@ -419,7 +419,7 @@ func (this *BusinessConfController) GetSingle() {
 	// 获取配置信息
 	confOb, e := models.GetBusinessConfByKey(confKey)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "配置不存在"
 			return
 		}

+ 4 - 3
controllers/classify.go

@@ -355,7 +355,7 @@ func (this *ClassifyController) ParentClassify() {
 	parentMenus, e := models.GetClassifyMenuList(menuCond, menuPars)
 	if e != nil {
 		br.Msg = "获取失败"
-		br.ErrMsg = "获取一级分类子目录列表失败"
+		br.ErrMsg = fmt.Sprintf("获取一级分类子目录列表失败, %v", e)
 		return
 	}
 	for i := range parentMenus {
@@ -494,7 +494,7 @@ func (this *ClassifyController) ListClassify() {
 	parentMenus, e := models.GetClassifyMenuList(menuCond, menuPars)
 	if e != nil {
 		br.Msg = "获取失败"
-		br.ErrMsg = "获取一级分类子目录列表失败"
+		br.ErrMsg = fmt.Sprintf("获取一级分类子目录列表失败, %v", e)
 		return
 	}
 	for i := range parentMenus {
@@ -677,6 +677,7 @@ func (this *ClassifyController) TelListClassify() {
 		condition += ` AND classify_name <> '晨报' AND classify_name <> '周报' `
 	}
 	telList, e := models.GetClassifyByCondition(condition, orderRule, pars)
+
 	if e != nil {
 		return
 	}
@@ -766,7 +767,7 @@ func (this *ClassifyController) SetEnabled() {
 	}
 	item, err := models.GetClassifyById(req.ClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在"
 			return
 		}

+ 4 - 4
controllers/cloud_disk.go

@@ -66,7 +66,7 @@ func (this *CloudDiskController) MenuCreate() {
 	existCond := ` AND menu_name = ? AND parent_id = ? `
 	existPars := make([]interface{}, 0)
 	existPars = append(existPars, req.MenuName, req.ParentId)
-	if e := existItem.GetItemByCondition(existCond, existPars); e != nil && e.Error() != utils.ErrNoRow() {
+	if e := existItem.GetItemByCondition(existCond, existPars); e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "操作失败"
 		br.ErrMsg = "获取重名目录失败, Err: " + e.Error()
 		return
@@ -147,7 +147,7 @@ func (this *CloudDiskController) MenuRename() {
 	existCond := ` AND menu_name = ? AND parent_id = ? AND menu_id <> ? `
 	existPars := make([]interface{}, 0)
 	existPars = append(existPars, req.MenuName, menuItem.ParentId, menuItem.MenuId)
-	if e := existItem.GetItemByCondition(existCond, existPars); e != nil && e.Error() != utils.ErrNoRow() {
+	if e := existItem.GetItemByCondition(existCond, existPars); e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "操作失败"
 		br.ErrMsg = "获取重名目录失败, Err: " + e.Error()
 		return
@@ -685,7 +685,7 @@ func (this *CloudDiskController) ResourceUpload() {
 	existCond := ` AND resource_name = ? AND menu_id = ? `
 	existPars := make([]interface{}, 0)
 	existPars = append(existPars, fileName, menuId)
-	if e := existItem.GetItemByCondition(existCond, existPars); e != nil && e.Error() != utils.ErrNoRow() {
+	if e := existItem.GetItemByCondition(existCond, existPars); e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "操作失败"
 		br.ErrMsg = "获取重名文件失败, Err: " + e.Error()
 		return
@@ -837,7 +837,7 @@ func (this *CloudDiskController) ResourceRename() {
 	existCond := ` AND resource_name = ? AND menu_id = ? AND resource_id <> ? `
 	existPars := make([]interface{}, 0)
 	existPars = append(existPars, req.ResourceName, resourceItem.MenuId, resourceItem.ResourceId)
-	if e := existItem.GetItemByCondition(existCond, existPars); e != nil && e.Error() != utils.ErrNoRow() {
+	if e := existItem.GetItemByCondition(existCond, existPars); e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "操作失败"
 		br.ErrMsg = "获取重名文件失败, Err: " + e.Error()
 		return

+ 2 - 2
controllers/commodity_trade_base_index.go

@@ -2639,7 +2639,7 @@ func (this *TradeCommonController) MtjhData() {
 		product.CreateTime = v.CreateTime
 
 		modifyTime, err := data_manage.GetMtjhIndexLatestDate(v.IndexCode)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取更新时间失败"
 			br.ErrMsg = "获取更新时间失败,Err:" + err.Error()
 			return
@@ -2741,7 +2741,7 @@ func (this *TradeCommonController) MtjhSingleData() {
 	}
 
 	modifyTime, err := data_manage.GetMtjhIndexLatestDate(indexCode)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取更新时间失败"
 		br.ErrMsg = "获取更新时间失败,Err:" + err.Error()
 		return

+ 4 - 4
controllers/company_seller.go

@@ -41,9 +41,9 @@ func (this *CompanySellerController) CheckListV2() {
 	productId := services.GetProductId(sysUser.RoleTypeCode)
 	switch productId {
 	case 1:
-		roleCodeTypeStr = `"` + utils.ROLE_TYPE_CODE_FICC_SELLER + `","` + utils.ROLE_TYPE_CODE_FICC_GROUP + `","` + utils.ROLE_TYPE_CODE_FICC_TEAM + `"`
+		roleCodeTypeStr = `'` + utils.ROLE_TYPE_CODE_FICC_SELLER + `','` + utils.ROLE_TYPE_CODE_FICC_GROUP + `','` + utils.ROLE_TYPE_CODE_FICC_TEAM + `'`
 	case 2:
-		roleCodeTypeStr = `"` + utils.ROLE_TYPE_CODE_RAI_SELLER + `","` + utils.ROLE_TYPE_CODE_RAI_GROUP + `"`
+		roleCodeTypeStr = `'` + utils.ROLE_TYPE_CODE_RAI_SELLER + `','` + utils.ROLE_TYPE_CODE_RAI_GROUP + `'`
 	}
 
 	// ficc管理员,不要只查销售
@@ -51,7 +51,7 @@ func (this *CompanySellerController) CheckListV2() {
 		roleCodeTypeStr = ``
 	} else if sysUser.RoleTypeCode == utils.ROLE_TYPE_CODE_RAI_ADMIN {
 		// 权益管理员,查看所有权益的账号
-		roleCodeTypeStr = `"` + utils.ROLE_TYPE_CODE_RAI_SELLER + `","` + utils.ROLE_TYPE_CODE_RAI_GROUP + `","` + utils.ROLE_TYPE_CODE_RAI_RESEARCHR + `","` + utils.ROLE_TYPE_CODE_RAI_ADMIN + `"`
+		roleCodeTypeStr = `'` + utils.ROLE_TYPE_CODE_RAI_SELLER + `','` + utils.ROLE_TYPE_CODE_RAI_GROUP + `','` + utils.ROLE_TYPE_CODE_RAI_RESEARCHR + `','` + utils.ROLE_TYPE_CODE_RAI_ADMIN + `'`
 	}
 
 	getAllSeller, _ := this.GetBool("AllSeller", false)
@@ -1726,7 +1726,7 @@ func (this *CompanySellerController) CheckListV2() {
 
 	// 海外销售部-目前无权限, 均可见
 	seaDepartment, e := system.GetSysDepartmentByName("海外销售部")
-	if e != nil && e.Error() != utils.ErrNoRow() {
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取海外销售部失败, Err: " + e.Error()
 		return

+ 4 - 4
controllers/data_manage/ai_predict_model/classify.go

@@ -269,7 +269,7 @@ func (this *AiPredictModelClassifyController) Edit() {
 	classifyOb := new(aiPredictModel.AiPredictModelClassify)
 	classifyItem, e := classifyOb.GetItemById(req.ClassifyId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "分类不存在, 请刷新页面"
 			return
 		}
@@ -359,7 +359,7 @@ func (this *AiPredictModelClassifyController) RemoveCheck() {
 
 	if deleteStatus != 1 && req.IndexId == 0 {
 		classifyCount, err := aiPredictModel.GetAiPredictModelClassifyCountByClassifyId(req.ClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "分类下是否含有图表失败,Err:" + err.Error()
 			return
@@ -411,7 +411,7 @@ func (this *AiPredictModelClassifyController) Remove() {
 	// 删除分类
 	if req.ClassifyId > 0 && req.IndexId == 0 {
 		count, err := aiPredictModel.GetAiPredictModelIndexCountByClassifyId(req.ClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
 			return
@@ -434,7 +434,7 @@ func (this *AiPredictModelClassifyController) Remove() {
 		indexOb := new(aiPredictModel.AiPredictModelIndex)
 		aiIndex, e := indexOb.GetItemById(req.IndexId)
 		if e != nil {
-			if e.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(e) {
 				br.Ret = 200
 				br.Msg = "删除成功"
 				br.Success = true

+ 14 - 14
controllers/data_manage/ai_predict_model/framework.go

@@ -124,12 +124,12 @@ func (c *AiPredictModelFrameworkController) Add() {
 		pars := make([]interface{}, 0)
 		pars = append(pars, req.FrameworkName, sysUser.AdminId)
 		exist, e := ob.GetItemByCondition(cond, pars)
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "操作失败"
 			br.ErrMsg = "获取重名框架失败, Err: " + e.Error()
 			return
 		}
-		if exist != nil {
+		if exist != nil && exist.AiPredictModelFrameworkId > 0 {
 			br.Msg = "框架名称已存在,请重新输入"
 			return
 		}
@@ -223,7 +223,7 @@ func (c *AiPredictModelFrameworkController) Edit() {
 	frameworkOb := new(aiPredictModel.AiPredictModelFramework)
 	item, e := frameworkOb.GetItemById(req.AiPredictModelFrameworkId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "框架不存在, 请刷新页面"
 			return
 		}
@@ -245,12 +245,12 @@ func (c *AiPredictModelFrameworkController) Edit() {
 		pars := make([]interface{}, 0)
 		pars = append(pars, req.AiPredictModelFrameworkId, req.FrameworkName, sysUser.AdminId)
 		exist, e := ob.GetItemByCondition(cond, pars)
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "操作失败"
 			br.ErrMsg = "获取重名框架失败, Err: " + e.Error()
 			return
 		}
-		if exist != nil {
+		if exist != nil && exist.AiPredictModelFrameworkId > 0 {
 			br.Msg = "框架名称已存在,请重新输入"
 			return
 		}
@@ -335,7 +335,7 @@ func (c *AiPredictModelFrameworkController) Remove() {
 	ob := new(aiPredictModel.AiPredictModelFramework)
 	item, e := ob.GetItemById(req.AiPredictModelFrameworkId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Ret = 200
 			br.Success = true
 			br.Msg = "操作成功"
@@ -405,7 +405,7 @@ func (c *AiPredictModelFrameworkController) Rename() {
 	frameworkOb := new(aiPredictModel.AiPredictModelFramework)
 	item, e := frameworkOb.GetItemById(req.AiPredictModelFrameworkId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "框架不存在, 请刷新页面"
 			return
 		}
@@ -427,12 +427,12 @@ func (c *AiPredictModelFrameworkController) Rename() {
 		pars := make([]interface{}, 0)
 		pars = append(pars, req.AiPredictModelFrameworkId, req.FrameworkName, sysUser.AdminId)
 		exist, e := ob.GetItemByCondition(cond, pars)
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "操作失败"
 			br.ErrMsg = "获取重名框架失败, Err: " + e.Error()
 			return
 		}
-		if exist != nil {
+		if exist != nil && exist.AiPredictModelFrameworkId > 0 {
 			br.Msg = "框架名称已存在,请重新输入"
 			return
 		}
@@ -491,7 +491,7 @@ func (c *AiPredictModelFrameworkController) Move() {
 	frameworkOb := new(aiPredictModel.AiPredictModelFramework)
 	item, e := frameworkOb.GetItemById(req.AiPredictModelFrameworkId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "框架不存在, 请刷新页面"
 			return
 		}
@@ -538,7 +538,7 @@ func (c *AiPredictModelFrameworkController) Move() {
 		updateCols = append(updateCols, "Sort", "ModifyTime")
 	} else {
 		first, err := aiPredictModel.GetFirstAiPredictModelFramework()
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "操作失败"
 			br.ErrMsg = "获取我的模型框架排首位的数据失败, Err:" + err.Error()
 			return
@@ -599,7 +599,7 @@ func (c *AiPredictModelFrameworkController) Detail() {
 	frameworkOb := new(aiPredictModel.AiPredictModelFramework)
 	item, e := frameworkOb.GetItemById(frameworkId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "框架不存在, 请刷新页面"
 			return
 		}
@@ -633,9 +633,9 @@ func (c *AiPredictModelFrameworkController) Detail() {
 		indexIdNum := len(aiPredictModelIndexIdList)
 		if indexIdNum > 0 {
 			indexObj := aiPredictModel.AiPredictModelIndex{}
-			indexList, e := indexObj.GetItemsByCondition(` AND ai_predict_model_index_id in (`+utils.GetOrmInReplace(indexIdNum)+`)`, aiPredictModelIndexIdList, []string{}, "")
+			indexList, e := indexObj.GetItemsByCondition(` AND ai_predict_model_index_id in (`+utils.GetOrmInReplace(indexIdNum)+`)`, []interface{}{aiPredictModelIndexIdList}, []string{}, "")
 			if e != nil {
-				if e.Error() == utils.ErrNoRow() {
+				if utils.IsErrNoRow(e) {
 					br.Msg = "框架不存在, 请刷新页面"
 					return
 				}

+ 7 - 7
controllers/data_manage/ai_predict_model/index.go

@@ -648,7 +648,7 @@ func (this *AiPredictModelIndexController) Detail() {
 	indexOb := new(aiPredictModel.AiPredictModelIndex)
 	indexItem, e := indexOb.GetItemById(indexId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "标的已被删除,请刷新页面"
 			return
 		}
@@ -756,7 +756,7 @@ func (this *AiPredictModelIndexController) Save() {
 	indexOb := new(aiPredictModel.AiPredictModelIndex)
 	indexItem, e := indexOb.GetItemById(req.IndexId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "标的已被删除,请刷新页面"
 			return
 		}
@@ -837,7 +837,7 @@ func (this *AiPredictModelIndexController) DashboardSave() {
 	indexOb := new(aiPredictModel.AiPredictModelIndex)
 	_, e := indexOb.GetItemById(req.IndexId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "标的已被删除,请刷新页面"
 			return
 		}
@@ -855,12 +855,12 @@ func (this *AiPredictModelIndexController) DashboardSave() {
 		pars := make([]interface{}, 0)
 		pars = append(pars, req.IndexId)
 		item, e := dashboardItem.GetItemByCondition(cond, pars, "")
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "操作失败"
 			br.ErrMsg = fmt.Sprintf("获取标的看板失败, %v", e)
 			return
 		}
-		if item != nil {
+		if item != nil && item.AiPredictModelIndexId > 0 {
 			isUpdate = true
 			dashboardItem = item
 			dashboardItem.DashboardName = req.DashboardName
@@ -930,7 +930,7 @@ func (this *AiPredictModelIndexController) DashboardDetail() {
 	indexOb := new(aiPredictModel.AiPredictModelIndex)
 	indexItem, e := indexOb.GetItemById(indexId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "标的已被删除,请刷新页面"
 			return
 		}
@@ -949,7 +949,7 @@ func (this *AiPredictModelIndexController) DashboardDetail() {
 		pars := make([]interface{}, 0)
 		pars = append(pars, indexId)
 		item, e := dashboardOb.GetItemByCondition(cond, pars, "")
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "操作失败"
 			br.ErrMsg = fmt.Sprintf("获取标的看板失败, %v", e)
 			return

+ 5 - 5
controllers/data_manage/baiinfo_data.go

@@ -36,14 +36,14 @@ func (this *EdbInfoController) BaiinfoClassify() {
 	}
 
 	rootList, err := data_manage.GetBaseFromBaiinfoClassifyByParentId(0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	classifyAll, err := data_manage.GetAllBaseFromBaiinfoClassify()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -52,7 +52,7 @@ func (this *EdbInfoController) BaiinfoClassify() {
 	baseFromBaiinfoIndexMap := make(map[int][]*data_manage.BaseFromBaiinfoClassifyItems)
 
 	allBaseFromBaiinfoIndex, err := data_manage.GetBaiinfoIndexAll()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 		return
@@ -144,14 +144,14 @@ func (this *EdbInfoController) BaiinfoClassifyName() {
 	}
 
 	rootList, err := data_manage.GetBaseFromBaiinfoClassifyByParentId(0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	classifyAll, err := data_manage.GetAllBaseFromBaiinfoClassify()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return

+ 3 - 2
controllers/data_manage/base_from_ly_index_controller.go

@@ -114,8 +114,9 @@ func (this *BaseFromLyIndexController) LyIndexDataList() {
 	if currentIndex <= 0 {
 		currentIndex = 1
 	}
+	startSize := utils.StartIndex(currentIndex, pageSize)
 
-	indexDataList, err := data.GetIndexDataPage(indexId, currentIndex, pageSize)
+	indexDataList, err := data.GetIndexDataPage(indexId, startSize, pageSize)
 	if err != nil {
 		br.Msg = "获取指标数据列表失败"
 		br.ErrMsg = "获取指标数据列表失败,Err:" + err.Error()
@@ -459,7 +460,7 @@ func (this *BaseFromLyIndexController) LyIndexDataExport() {
 
 			var lyDataList []*data_manage.BaseFromLyData
 			lyDataList, err = data_manage.GetBaseFromLyDataByIndexCode(v.IndexCode)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.ErrMsg = "GetBaseFromLyDataByIndexCode,Err:" + err.Error()
 				br.Msg = "获取数据失败"
 				return

+ 1 - 1
controllers/data_manage/base_from_rzd_index_controller.go

@@ -580,7 +580,7 @@ func (this *BaseFromRzdIndexController) RzdIndexDataExport() {
 
 			var dataList []*data_manage.BaseFromRzdData
 			dataList, err = data_manage.GetBaseFormRzdDataByIndexCode(v.IndexCode)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.ErrMsg = "GetBaseFormRzdDataByIndexCode,Err:" + err.Error()
 				br.Msg = "获取数据失败"
 				return

+ 4 - 4
controllers/data_manage/base_from_ths_hf.go

@@ -728,7 +728,7 @@ func (this *BaseFromThsHfController) Edit() {
 	indexOb := new(data_manage.BaseFromThsHfIndex)
 	item, e := indexOb.GetItemById(params.IndexId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "指标不存在, 请刷新页面"
 			return
 		}
@@ -819,7 +819,7 @@ func (this *BaseFromThsHfController) Detail() {
 	indexOb := new(data_manage.BaseFromThsHfIndex)
 	item, e := indexOb.GetItemById(indexId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "指标不存在, 请刷新页面"
 			return
 		}
@@ -899,7 +899,7 @@ func (this *BaseFromThsHfController) Refresh() {
 	indexOb := new(data_manage.BaseFromThsHfIndex)
 	_, e := indexOb.GetItemById(params.IndexId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "指标不存在, 请刷新页面"
 			return
 		}
@@ -959,7 +959,7 @@ func (this *BaseFromThsHfController) Remove() {
 	indexOb := new(data_manage.BaseFromThsHfIndex)
 	item, e := indexOb.GetItemById(params.IndexId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Ret = 200
 			br.Success = true
 			br.Msg = "操作成功"

+ 2 - 2
controllers/data_manage/base_from_ths_hf_classify.go

@@ -301,7 +301,7 @@ func (this *BaseFromThsHfController) ClassifyEdit() {
 	classifyOb := new(data_manage.BaseFromThsHfClassify)
 	classifyItem, e := classifyOb.GetItemById(req.ClassifyId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "分类不存在, 请刷新页面"
 			return
 		}
@@ -382,7 +382,7 @@ func (this *BaseFromThsHfController) ClassifyRemove() {
 	classifyOb := new(data_manage.BaseFromThsHfClassify)
 	classifyItem, e := classifyOb.GetItemById(req.ClassifyId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Ret = 200
 			br.Success = true
 			br.Msg = "获取成功"

+ 25 - 24
controllers/data_manage/bloomberg_data.go

@@ -7,7 +7,6 @@ import (
 	"eta/eta_api/models/data_manage"
 	"eta/eta_api/models/system"
 	"eta/eta_api/services/data"
-	"eta/eta_api/services/elastic"
 	etaTrialService "eta/eta_api/services/eta_trial"
 	"eta/eta_api/utils"
 	"fmt"
@@ -75,8 +74,8 @@ func (this *BloombergDataController) List() {
 		params.Keywords = strings.TrimSpace(params.Keywords)
 		if params.Keywords != "" {
 			// 空格分词搜
-			//indexCodeCol := data_manage.BaseFromBloombergIndexCols.IndexCode
-			//indexNameCol := data_manage.BaseFromBloombergIndexCols.IndexName
+			indexCodeCol := data_manage.BaseFromBloombergIndexCols.IndexCode
+			indexNameCol := data_manage.BaseFromBloombergIndexCols.IndexName
 			//keywordArr := strings.Split(params.Keywords, " ")
 			//if len(keywordArr) > 1 {
 			//	sliceArr := make([]string, 0)
@@ -95,29 +94,31 @@ func (this *BloombergDataController) List() {
 			//	cond += fmt.Sprintf(` AND (%s LIKE ? OR %s LIKE ?)`, indexCodeCol, indexNameCol)
 			//	pars = utils.GetLikeKeywordPars(pars, params.Keywords, 2)
 			//}
+			cond += fmt.Sprintf(` AND (%s LIKE ? OR %s LIKE ?)`, indexCodeCol, indexNameCol)
+			pars = utils.GetLikeKeywordPars(pars, params.Keywords, 2)
 
 			// ES搜
-			_, list, e := elastic.SearchDataSourceIndex(utils.EsDataSourceIndexName, params.Keywords, utils.DATA_SOURCE_BLOOMBERG, 0, []int{}, []int{}, []string{}, startSize, params.PageSize)
-			if e != nil {
-				br.Msg = "获取失败"
-				br.ErrMsg = fmt.Sprintf("ES-搜索Bloomberg指标失败, %v", e)
-				return
-			}
-			if len(list) == 0 {
-				dataResp.Paging = paging.GetPaging(params.CurrentIndex, params.PageSize, 0)
-				dataResp.List = make([]*data_manage.BaseFromBloombergIndexItem, 0)
-				br.Data = dataResp
-				br.Ret = 200
-				br.Success = true
-				br.Msg = "获取成功"
-				return
-			}
-			var indexIds []int
-			for _, v := range list {
-				indexIds = append(indexIds, v.PrimaryId)
-			}
-			cond += fmt.Sprintf(" AND %s IN (%s)", data_manage.BaseFromBloombergIndexCols.BaseFromBloombergIndexId, utils.GetOrmInReplace(len(indexIds)))
-			pars = append(pars, indexIds)
+			//_, list, e := elastic.SearchDataSourceIndex(utils.EsDataSourceIndexName, params.Keywords, utils.DATA_SOURCE_BLOOMBERG, 0, []int{}, []int{}, []string{}, startSize, params.PageSize)
+			//if e != nil {
+			//	br.Msg = "获取失败"
+			//	br.ErrMsg = fmt.Sprintf("ES-搜索Bloomberg指标失败, %v", e)
+			//	return
+			//}
+			//if len(list) == 0 {
+			//	dataResp.Paging = paging.GetPaging(params.CurrentIndex, params.PageSize, 0)
+			//	dataResp.List = make([]*data_manage.BaseFromBloombergIndexItem, 0)
+			//	br.Data = dataResp
+			//	br.Ret = 200
+			//	br.Success = true
+			//	br.Msg = "获取成功"
+			//	return
+			//}
+			//var indexIds []int
+			//for _, v := range list {
+			//	indexIds = append(indexIds, v.PrimaryId)
+			//}
+			//cond += fmt.Sprintf(" AND %s IN (%s)", data_manage.BaseFromBloombergIndexCols.BaseFromBloombergIndexId, utils.GetOrmInReplace(len(indexIds)))
+			//pars = append(pars, indexIds)
 		}
 
 		if params.Frequency != "" {

+ 2 - 2
controllers/data_manage/business_data.go

@@ -38,7 +38,7 @@ func (c *EdbBusinessController) SourceList() {
 
 	obj := data_manage.EdbBusinessSource{}
 	list, err := obj.GetAllList()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -600,7 +600,7 @@ func (c *EdbBusinessController) DataList() {
 
 	// 获取分页数据
 	dataCount, dataList, err := data.GetPageBaseBusinessIndexData(req.IndexCode, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取指标信息失败"
 		br.ErrMsg = "获取指标数据总数失败,Err:" + err.Error()
 		return

+ 2 - 2
controllers/data_manage/ccf_data.go

@@ -751,7 +751,7 @@ func (this *EdbInfoController) CCFStockTable() {
 	// 若无tableDate默认取最近的有数据的表格
 	item, e := excelOb.GetItemByCondition(cond, pars, fmt.Sprintf("%s DESC", excelOb.Cols().ExcelDate))
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Ret = 200
 			br.Success = true
 			br.Msg = "该日期暂无数据"
@@ -1075,7 +1075,7 @@ func (this *EdbInfoController) CCFIndexNameCheck() {
 			EdbName: v.EdbName,
 		})
 		dataItems, err := data_manage.GetEdbDataAllByEdbCode(v.EdbCode, utils.DATA_SOURCE_CCF, 0, utils.EDB_DATA_LIMIT)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取钢联已存在信息失败,Err:" + err.Error()
 			return

+ 76 - 49
controllers/data_manage/chart_classify.go

@@ -13,6 +13,12 @@ import (
 	"time"
 )
 
+const (
+	CHART_CLASSIFY_ADD_OR_EDIT = "chartLib:classifyOpt:add"
+	CHART_CLASSIFY_DELETE      = "chartLib:classifyOpt:delete"
+	CHART_CLASSIFY_MOVE        = "chartLib:classifyOpt:move"
+)
+
 // 数据管理-分类模块
 type ChartClassifyController struct {
 	controllers.BaseAuthController
@@ -76,7 +82,7 @@ func (this *ChartClassifyController) ChartClassifyListV2() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -129,21 +135,21 @@ func (this *ChartClassifyController) ChartClassifyListV2() {
 	}
 
 	rootList, err := data_manage.GetChartClassifyByParentId(0, utils.CHART_SOURCE_DEFAULT)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	classifyAll, err := data_manage.GetChartClassifyAll(utils.CHART_SOURCE_DEFAULT)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	allChartInfo, err := data_manage.GetChartInfoAll([]int{utils.CHART_SOURCE_DEFAULT})
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 		return
@@ -202,19 +208,19 @@ func (this *ChartClassifyController) ChartClassifyListV2() {
 // getChartClassifyListForMe 获取我创建的图表
 func getChartClassifyListForMe(adminInfo system.Admin, resp *data_manage.ChartClassifyListResp) (errMsg string, err error) {
 	rootList, err := data_manage.GetChartClassifyByParentId(0, utils.CHART_SOURCE_DEFAULT)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
 
 	classifyAll, err := data_manage.GetChartClassifyAll(utils.CHART_SOURCE_DEFAULT)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
 
 	allChartInfo, err := data_manage.GetChartInfoByAdminId([]int{utils.CHART_SOURCE_DEFAULT}, adminInfo.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
@@ -503,7 +509,7 @@ func (this *ChartClassifyController) DeleteChartClassifyCheck() {
 
 	if deleteStatus != 1 && req.ChartInfoId == 0 {
 		classifyCount, err := data_manage.GetChartClassifyCountByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "分类下是否含有图表失败,Err:" + err.Error()
 			return
@@ -590,7 +596,7 @@ func (this *ChartClassifyController) DeleteChartClassify() {
 
 		//判断是否含有指标
 		count, err := data_manage.GetChartInfoCountByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
 			return
@@ -614,7 +620,7 @@ func (this *ChartClassifyController) DeleteChartClassify() {
 	if req.ChartInfoId > 0 {
 		chartInfo, err := data_manage.GetChartInfoById(req.ChartInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "图表已删除,请刷新页面"
 				br.ErrMsg = "指标不存在,Err:" + err.Error()
 				return
@@ -704,7 +710,7 @@ func (this *ChartClassifyController) DeleteChartClassify() {
 		pars = append(pars, req.ChartInfoId)
 
 		nextItem, err := data_manage.GetChartInfoByCondition(condition, pars)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
 			return
@@ -724,14 +730,14 @@ func (this *ChartClassifyController) DeleteChartClassify() {
 			pars = append(pars, chartInfo.ChartClassifyId)
 
 			classifyItem, err := data_manage.GetChartClassifyByCondition(condition, pars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "删除失败"
 				br.ErrMsg = "获取下一级图库分类信息失败,Err:" + err.Error()
 				return
 			}
 			if classifyItem != nil {
 				nextItem, err = data_manage.GetNextChartInfo(chartInfo.ChartClassifyId)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					br.Msg = "删除失败"
 					br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
 					return
@@ -806,7 +812,7 @@ func (this *ChartClassifyController) ChartClassifyMove() {
 	//判断分类是否存在
 	chartClassifyInfo, err := data_manage.GetChartClassifyById(req.ClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在,请刷新页面"
 			return
 		}
@@ -817,12 +823,12 @@ func (this *ChartClassifyController) ChartClassifyMove() {
 
 	// 校验移动的父级目录下是否有重名分类
 	exists, e := data_manage.GetChartClassifyByParentIdAndName(req.ParentClassifyId, chartClassifyInfo.ChartClassifyName, req.ClassifyId)
-	if e != nil && e.Error() != utils.ErrNoRow() {
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "移动失败"
 		br.ErrMsg = "获取父级目录下的同名分类失败, Err: " + e.Error()
 		return
 	}
-	if exists != nil {
+	if exists != nil && exists.ChartClassifyId > 0 {
 		br.Msg = "移动失败,分类名称已存在"
 		return
 	}
@@ -906,7 +912,7 @@ func (this *ChartClassifyController) ChartClassifyMove() {
 
 	} else {
 		firstClassify, err := data_manage.GetFirstChartClassifyByParentId(chartClassifyInfo.ParentId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "获取获取当前父级分类下的排序第一条的分类信息失败,Err:" + err.Error()
 			return
@@ -940,13 +946,13 @@ func (this *ChartClassifyController) ChartClassifyMove() {
 // getChartClassifyListForMe 获取我创建的图表分类
 func getChartClassifyListForMeV2(adminInfo system.Admin, resp *data_manage.ChartClassifyListResp) (errMsg string, err error) {
 	rootList, err := data_manage.GetChartClassifyByParentId(0, utils.CHART_SOURCE_DEFAULT)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
 
 	classifyAll, err := data_manage.GetChartClassifyAll(utils.CHART_SOURCE_DEFAULT)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
@@ -1005,7 +1011,7 @@ func (this *ChartClassifyController) ChartClassifyChartListV2() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -1018,7 +1024,7 @@ func (this *ChartClassifyController) ChartClassifyChartListV2() {
 	isShowMe, _ := this.GetBool("IsShowMe")
 	if isShowMe {
 		allChartInfo, err := data_manage.GetChartInfoByAdminIdAndClassify([]int{utils.CHART_SOURCE_DEFAULT}, sysUser.AdminId, chartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取全部数据失败,Err:" + err.Error()
 			return
@@ -1036,7 +1042,7 @@ func (this *ChartClassifyController) ChartClassifyChartListV2() {
 	}
 
 	allChartInfo, err := data_manage.GetChartInfoAllByClassifyId(utils.CHART_SOURCE_DEFAULT, chartClassifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 		return
@@ -1095,7 +1101,7 @@ func (this *ChartClassifyController) ChartClassifyChartListV3() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -1104,51 +1110,72 @@ func (this *ChartClassifyController) ChartClassifyChartListV3() {
 			noPermissionChartIdMap[v.ChartInfoId] = true
 		}
 	}
-
+	var allNodes []*data_manage.ChartClassifyItems
 	isShowMe, _ := this.GetBool("IsShowMe")
 	if isShowMe {
 		allChartInfo, err := data_manage.GetChartClassifyAndInfoByParentIdForMe(chartClassifyId, sysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
 		}
 		// 移除没有权限的图表
-		allNodes := data.HandleNoPermissionChart(allChartInfo, noPermissionChartIdMap, this.SysUser.AdminId)
+		allNodes = data.HandleNoPermissionChart(allChartInfo, noPermissionChartIdMap, this.SysUser.AdminId)
 		allNodes, err = data.GetChartClassifyByIsMe(sysUser.AdminId, chartClassifyId, utils.CHART_SOURCE_DEFAULT, allNodes)
 		if err != nil {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
 		}
-		resp.AllNodes = allNodes
-
-		br.Ret = 200
-		br.Success = true
-		br.Msg = "获取成功"
-		br.Data = resp
-		fmt.Println("source my classify")
-		return
+		//resp.AllNodes = allNodes
+		//
+		//br.Ret = 200
+		//br.Success = true
+		//br.Msg = "获取成功"
+		//br.Data = resp
+		//fmt.Println("source my classify")
+		//return
+	} else {
+		allChartInfo, err := data_manage.GetChartClassifyAndInfoByParentId(chartClassifyId)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
+			return
+		}
+		//allChartInfo, err := data_manage.GetChartInfoAllByClassifyId(utils.CHART_SOURCE_DEFAULT, chartClassifyId)
+		//if err != nil && err.Error() != utils.ErrNoRow() {
+		//	br.Msg = "获取失败"
+		//	br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
+		//	return
+		//}
+		// 移除没有权限的图表
+		allNodes = data.HandleNoPermissionChart(allChartInfo, noPermissionChartIdMap, this.SysUser.AdminId)
 	}
-
-	allChartInfo, err := data_manage.GetChartClassifyAndInfoByParentId(chartClassifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	menulist, e := system.GetMenuButtonsByRoleId(this.SysUser.RoleId)
+	if e != nil {
 		br.Msg = "获取失败"
-		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		br.ErrMsg = "获取角色按钮权限失败, Err: " + e.Error()
 		return
 	}
-
-	//allChartInfo, err := data_manage.GetChartInfoAllByClassifyId(utils.CHART_SOURCE_DEFAULT, chartClassifyId)
-	//if err != nil && err.Error() != utils.ErrNoRow() {
-	//	br.Msg = "获取失败"
-	//	br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
-	//	return
-	//}
-	// 移除没有权限的图表
-	allNodes := data.HandleNoPermissionChart(allChartInfo, noPermissionChartIdMap, this.SysUser.AdminId)
-
+	buttonList := make(map[string]int, 0)
+	for _, item := range menulist {
+		if item.MenuType == 1 {
+			buttonList[item.ButtonCode] = 1
+		}
+	}
+	var addOrEditRight, deleteRight, moveRight bool
+	if _, ok := buttonList[CHART_CLASSIFY_ADD_OR_EDIT]; ok {
+		addOrEditRight = true
+	}
+	if _, ok := buttonList[CHART_CLASSIFY_DELETE]; ok {
+		deleteRight = true
+	}
+	if _, ok := buttonList[CHART_CLASSIFY_MOVE]; ok {
+		moveRight = true
+	}
 	for k, item := range allNodes {
-		item.Button = data.GetChartOpButton(this.SysUser, item.SysUserId, item.HaveOperaAuth)
+		//item.Button = data.GetChartOpButton(this.SysUser, item.SysUserId, item.HaveOperaAuth)
+		item.Button = data.GetChartOpButtonV2(item.HaveOperaAuth, addOrEditRight, deleteRight, moveRight)
 		if item.ChartInfoId > 0 {
 			item.Button.AddButton = false
 			item.Button.OpButton = false

+ 1 - 1
controllers/data_manage/chart_common.go

@@ -54,7 +54,7 @@ func (this *ChartInfoController) CommonChartInfoDetailFromUniqueCode() {
 	status := true
 	chartInfo, err := data_manage.GetChartInfoViewByUniqueCode(uniqueCode)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			status = false
 		} else {
 			br.Msg = "获取失败"

+ 2 - 2
controllers/data_manage/chart_edb_config.go

@@ -148,7 +148,7 @@ func (this *EdbInfoController) ModifyNoPermissionAdmin() {
 	edbInfo, err := data_manage.GetEdbInfoById(req.EdbInfoId)
 	if err != nil {
 		br.Msg = "修改失败"
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "找不到该指标"
 			br.IsSendEmail = false
 		}
@@ -208,7 +208,7 @@ func (this *EdbInfoController) DelNoPermissionAdmin() {
 	edbInfo, err := data_manage.GetEdbInfoById(req.EdbInfoId)
 	if err != nil {
 		br.Msg = "删除失败"
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "找不到该指标"
 			br.IsSendEmail = false
 		}

+ 13 - 13
controllers/data_manage/chart_framework.go

@@ -227,12 +227,12 @@ func (this *ChartFrameworkController) Add() {
 		pars := make([]interface{}, 0)
 		pars = append(pars, req.FrameworkName, sysUser.AdminId)
 		exist, e := ob.GetItemByCondition(cond, pars)
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "操作失败"
 			br.ErrMsg = "获取重名框架失败, Err: " + e.Error()
 			return
 		}
-		if exist != nil {
+		if exist != nil && exist.ChartFrameworkId > 0 {
 			br.Msg = "框架名称已存在"
 			return
 		}
@@ -337,7 +337,7 @@ func (this *ChartFrameworkController) Edit() {
 	frameworkOb := new(data_manage.ChartFramework)
 	item, e := frameworkOb.GetItemById(req.ChartFrameworkId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "框架不存在, 请刷新页面"
 			return
 		}
@@ -353,12 +353,12 @@ func (this *ChartFrameworkController) Edit() {
 		pars := make([]interface{}, 0)
 		pars = append(pars, req.ChartFrameworkId, req.FrameworkName, sysUser.AdminId)
 		exist, e := ob.GetItemByCondition(cond, pars)
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "操作失败"
 			br.ErrMsg = "获取重名框架失败, Err: " + e.Error()
 			return
 		}
-		if exist != nil {
+		if exist != nil && exist.ChartFrameworkId > 0 {
 			br.Msg = "框架名称已存在"
 			return
 		}
@@ -451,7 +451,7 @@ func (this *ChartFrameworkController) Remove() {
 	ob := new(data_manage.ChartFramework)
 	item, e := ob.GetItemById(req.ChartFrameworkId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Ret = 200
 			br.Success = true
 			br.Msg = "操作成功"
@@ -521,7 +521,7 @@ func (this *ChartFrameworkController) Rename() {
 	frameworkOb := new(data_manage.ChartFramework)
 	item, e := frameworkOb.GetItemById(req.ChartFrameworkId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "框架不存在, 请刷新页面"
 			return
 		}
@@ -537,12 +537,12 @@ func (this *ChartFrameworkController) Rename() {
 		pars := make([]interface{}, 0)
 		pars = append(pars, req.ChartFrameworkId, req.FrameworkName, sysUser.AdminId)
 		exist, e := ob.GetItemByCondition(cond, pars)
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "操作失败"
 			br.ErrMsg = "获取重名框架失败, Err: " + e.Error()
 			return
 		}
-		if exist != nil {
+		if exist != nil && exist.ChartFrameworkId > 0 {
 			br.Msg = "框架名称已存在"
 			return
 		}
@@ -606,7 +606,7 @@ func (this *ChartFrameworkController) EditPublic() {
 	frameworkOb := new(data_manage.ChartFramework)
 	item, e := frameworkOb.GetItemById(req.ChartFrameworkId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "框架不存在, 请刷新页面"
 			return
 		}
@@ -673,7 +673,7 @@ func (this *ChartFrameworkController) Move() {
 	frameworkOb := new(data_manage.ChartFramework)
 	item, e := frameworkOb.GetItemById(req.ChartFrameworkId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "框架不存在, 请刷新页面"
 			return
 		}
@@ -720,7 +720,7 @@ func (this *ChartFrameworkController) Move() {
 		updateCols = append(updateCols, "Sort", "ModifyTime")
 	} else {
 		first, err := data_manage.GetFirstChartFramework(sysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "操作失败"
 			br.ErrMsg = "获取我的图库框架排首位的数据失败, Err:" + err.Error()
 			return
@@ -781,7 +781,7 @@ func (this *ChartFrameworkController) Detail() {
 	frameworkOb := new(data_manage.ChartFramework)
 	item, e := frameworkOb.GetItemById(frameworkId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "框架不存在, 请刷新页面"
 			return
 		}

+ 132 - 54
controllers/data_manage/chart_info.go

@@ -2,6 +2,7 @@ package data_manage
 
 import (
 	"encoding/json"
+	"errors"
 	"eta/eta_api/controllers"
 	"eta/eta_api/models"
 	"eta/eta_api/models/data_manage"
@@ -10,6 +11,7 @@ import (
 	"eta/eta_api/services"
 	"eta/eta_api/services/alarm_msg"
 	"eta/eta_api/services/data"
+	"eta/eta_api/services/data/area_graph"
 	"eta/eta_api/services/data/data_manage_permission"
 	"eta/eta_api/services/data/excel"
 	"eta/eta_api/services/eta_forum"
@@ -66,7 +68,7 @@ func (this *ChartInfoController) ChartInfoSave() {
 
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,请刷新页面!"
 			br.ErrMsg = "图表已被删除,请刷新页面,ChartInfoId:" + strconv.Itoa(req.ChartInfoId)
 			return
@@ -334,7 +336,7 @@ func (this *ChartInfoController) ChartEnInfoEdit() {
 	//判断指标名称是否存在
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,请刷新页面"
 			br.ErrMsg = "图表已被删除,请刷新页面"
 			return
@@ -357,7 +359,7 @@ func (this *ChartInfoController) ChartEnInfoEdit() {
 		edbInfoId := v.EdbInfoId
 		edbInfo, err := data_manage.GetEdbInfoById(edbInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "图表不存在!"
 				br.ErrMsg = "图表指标不存在,ChartInfoId:" + strconv.Itoa(edbInfoId)
 				return
@@ -367,7 +369,7 @@ func (this *ChartInfoController) ChartEnInfoEdit() {
 				return
 			}
 		}
-		if edbInfo == nil {
+		if edbInfo == nil || edbInfo.EdbInfoId <= 0 {
 			br.Msg = "指标不存在!"
 			br.ErrMsg = "指标不存在,ChartInfoId:" + strconv.Itoa(edbInfoId)
 			return
@@ -389,7 +391,7 @@ func (this *ChartInfoController) ChartEnInfoEdit() {
 
 			edbExist, err := data_manage.GetEdbInfoByCondition(edbCondition, edbPars)
 			if err != nil {
-				if err.Error() != utils.ErrNoRow() {
+				if !utils.IsErrNoRow(err) {
 					br.Msg = "判断英文指标名称是否存在失败"
 					br.ErrMsg = "判断英文指标名称是否存在失败,Err:" + err.Error()
 					return
@@ -418,7 +420,7 @@ func (this *ChartInfoController) ChartEnInfoEdit() {
 
 		existItem, err := data_manage.GetChartInfoByCondition(condition, pars)
 		if err != nil {
-			if err.Error() != utils.ErrNoRow() {
+			if !utils.IsErrNoRow(err) {
 				br.Msg = "判断英文图表名称是否存在失败"
 				br.ErrMsg = "判断英文图表名称是否存在失败,Err:" + err.Error()
 				return
@@ -447,7 +449,7 @@ func (this *ChartInfoController) ChartEnInfoEdit() {
 		edbInfoId := v.EdbInfoId
 		edbInfo, err := data_manage.GetEdbInfoById(edbInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "图表不存在!"
 				br.ErrMsg = "图表指标不存在,ChartInfoId:" + strconv.Itoa(edbInfoId)
 				return
@@ -457,7 +459,7 @@ func (this *ChartInfoController) ChartEnInfoEdit() {
 				return
 			}
 		}
-		if edbInfo != nil {
+		if edbInfo != nil && edbInfo.EdbInfoId > 0 {
 			go data.AddOrEditEdbInfoToEs(edbInfoId)
 		}
 	}
@@ -526,7 +528,7 @@ func (this *ChartInfoController) ChartInfoBaseEdit() {
 	//判断指标名称是否存在
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,请刷新页面"
 			br.ErrMsg = "图表已被删除,请刷新页面"
 			return
@@ -549,7 +551,7 @@ func (this *ChartInfoController) ChartInfoBaseEdit() {
 		edbInfoId := v.EdbInfoId
 		edbInfo, err := data_manage.GetEdbInfoById(edbInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "图表不存在!"
 				br.ErrMsg = "图表指标不存在,ChartInfoId:" + strconv.Itoa(edbInfoId)
 				return
@@ -584,7 +586,7 @@ func (this *ChartInfoController) ChartInfoBaseEdit() {
 
 			edbExist, err := data_manage.GetEdbInfoByCondition(edbCondition, edbPars)
 			if err != nil {
-				if err.Error() != utils.ErrNoRow() {
+				if !utils.IsErrNoRow(err) {
 					br.Msg = "判断英文指标名称是否存在失败"
 					br.ErrMsg = "判断英文指标名称是否存在失败,Err:" + err.Error()
 					return
@@ -616,7 +618,7 @@ func (this *ChartInfoController) ChartInfoBaseEdit() {
 
 		existItem, err := data_manage.GetChartInfoByCondition(condition, pars)
 		if err != nil {
-			if err.Error() != utils.ErrNoRow() {
+			if !utils.IsErrNoRow(err) {
 				br.Msg = "判断英文图表名称是否存在失败"
 				br.ErrMsg = "判断英文图表名称是否存在失败,Err:" + err.Error()
 				return
@@ -645,7 +647,7 @@ func (this *ChartInfoController) ChartInfoBaseEdit() {
 		edbInfoId := v.EdbInfoId
 		edbInfo, err := data_manage.GetEdbInfoById(edbInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "图表不存在!"
 				br.ErrMsg = "图表指标不存在,ChartInfoId:" + strconv.Itoa(edbInfoId)
 				return
@@ -655,7 +657,7 @@ func (this *ChartInfoController) ChartInfoBaseEdit() {
 				return
 			}
 		}
-		if edbInfo != nil {
+		if edbInfo != nil && edbInfo.EdbInfoId > 0 {
 			go data.AddOrEditEdbInfoToEs(edbInfoId)
 		}
 	}
@@ -698,7 +700,7 @@ func (this *ChartInfoController) ChartInfoNewest() {
 		this.ServeJSON()
 	}()
 	item, err := data_manage.GetChartInfoByNewest(1)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取最新图表失败"
 		br.ErrMsg = "获取最新图表失败,Err:" + err.Error()
 		return
@@ -786,12 +788,12 @@ func (this *ChartInfoController) ChartInfoMove() {
 	if chartInfo.ChartClassifyId != req.ChartClassifyId {
 		//查询需要修改的分类下是否存在同一个图表名称
 		tmpChartInfo, tmpErr := data_manage.GetChartInfoByClassifyIdAndName(req.ChartClassifyId, chartInfo.ChartName)
-		if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
+		if tmpErr != nil && !utils.IsErrNoRow(tmpErr) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "移动失败,Err:" + tmpErr.Error()
 			return
 		}
-		if tmpChartInfo != nil {
+		if tmpChartInfo != nil && tmpChartInfo.ChartInfoId > 0 {
 			br.Msg = "移动失败,同一个分类下图表名称不允许重复"
 			br.ErrMsg = "移动失败,同一个分类下图表名称不允许重复"
 			return
@@ -845,14 +847,14 @@ func (this *ChartInfoController) ChartInfoMove() {
 
 	} else {
 		firstClassify, err := data_manage.GetFirstChartInfoByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "获取获取当前父级分类下的排序第一条的分类信息失败,Err:" + err.Error()
 			return
 		}
 
 		//如果该分类下存在其他分类,且第一个其他分类的排序等于0,那么需要调整排序
-		if firstClassify != nil && firstClassify.Sort == 0 {
+		if firstClassify != nil && firstClassify.ChartClassifyId > 0 && firstClassify.Sort == 0 {
 			updateSortStr := ` sort + 1 `
 			_ = data_manage.UpdateChartInfoSortByClassifyId(firstClassify.ChartClassifyId, 0, firstClassify.ChartInfoId-1, []int{chartInfo.Source}, updateSortStr)
 		}
@@ -959,7 +961,7 @@ func (this *ChartInfoController) ChartInfoDetail() {
 	if chartInfoId > 0 {
 		chartInfo, err = data_manage.GetChartInfoViewById(chartInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "该图表已删除,自动查看下一图表"
 				br.ErrMsg = "该图表已删除,自动查看下一图表,Err:" + err.Error()
 				br.Ret = 406
@@ -1028,7 +1030,7 @@ func (this *ChartInfoController) ChartInfoDetail() {
 	extraConfigStr := chartInfo.ExtraConfig
 	// 柱方图的一些配置
 	var barConfig data_manage.BarChartInfoReq
-	if chartInfo != nil && chartInfo.ChartType == 7 {
+	if chartInfo != nil && chartInfo.ChartInfoId > 0 && chartInfo.ChartType == 7 {
 		if chartInfo.BarConfig == `` {
 			br.Msg = "柱方图未配置"
 			br.ErrMsg = "柱方图未配置"
@@ -1128,7 +1130,7 @@ func (this *ChartInfoController) ChartInfoDetail() {
 		if len(warnEdbList) > 0 {
 			chartInfo.WarnMsg = `图表引用指标异常,异常指标:` + strings.Join(warnEdbList, ",")
 		}
-		if chartInfoId > 0 && chartInfo != nil {
+		if chartInfoId > 0 && chartInfo != nil && chartInfo.ChartInfoId > 0 {
 			//判断是否加入我的图库
 			{
 				var myChartCondition string
@@ -1139,7 +1141,7 @@ func (this *ChartInfoController) ChartInfoDetail() {
 				myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 				myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					br.Msg = "获取失败"
 					br.ErrMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 					return
@@ -1359,7 +1361,7 @@ func (this *ChartInfoController) PreviewChartInfoDetail() {
 	extraConfigStr := chartInfo.ExtraConfig
 	// 柱方图的一些配置
 	var barConfig data_manage.BarChartInfoReq
-	if chartInfo != nil && chartInfo.ChartType == 7 {
+	if chartInfo != nil && chartInfo.ChartInfoId > 0 && chartInfo.ChartType == 7 {
 		if chartInfo.BarConfig == `` {
 			br.Msg = "柱方图未配置"
 			br.ErrMsg = "柱方图未配置"
@@ -1372,7 +1374,9 @@ func (this *ChartInfoController) PreviewChartInfoDetail() {
 			return
 		}
 		extraConfigStr = chartInfo.BarConfig
-	} else if chartInfo != nil && chartInfo.ChartType == utils.CHART_TYPE_SECTION_COMBINE {
+	} else if chartInfo != nil && chartInfo.ChartInfoId > 0 && chartInfo.ChartType == utils.CHART_TYPE_SECTION_COMBINE {
+		extraConfigStr = req.ExtraConfig
+	} else if chartInfo != nil && chartInfo.ChartInfoId > 0 && chartInfo.ChartType == utils.CHART_TYPE_AREA {
 		extraConfigStr = req.ExtraConfig
 	}
 
@@ -1401,6 +1405,16 @@ func (this *ChartInfoController) PreviewChartInfoDetail() {
 		chartInfo.WarnMsg = `图表引用指标异常,异常指标:` + strings.Join(warnEdbList, ",")
 	}
 
+	// 面积图 面积堆积 数据处理
+	if req.ChartType == utils.CHART_TYPE_AREA {
+		err, errMsg = fillAreaGraphData(extraConfigStr, edbList)
+		if err != nil {
+			br.Msg = "面积图处理失败"
+			br.ErrMsg = errMsg
+			return
+		}
+	}
+
 	//图表操作权限
 	chartInfo.IsEdit = data.CheckOpChartPermission(sysUser, chartInfo.SysUserId, true)
 	//判断是否需要展示英文标识
@@ -1493,6 +1507,60 @@ func (this *ChartInfoController) PreviewChartInfoDetail() {
 	br.Data = resp
 }
 
+func fillAreaGraphData(extraConfigStr string, edbDataList []*data_manage.ChartEdbInfoMapping) (err error, errMsg string) {
+
+	var tmpConfig data_manage.AreaExtraConf
+	if extraConfigStr != `` {
+		err = json.Unmarshal([]byte(extraConfigStr), &tmpConfig)
+		if err != nil {
+			errMsg = "面积图配置异常"
+			err = errors.New(errMsg)
+			return
+		}
+		if tmpConfig.StandardEdbInfoId <= 0 {
+			utils.FileLog.Info("面积图未开启面积堆积")
+			return
+		}
+	}
+	if tmpConfig.IsHeap == 1 {
+		standardIndexMap := make(map[string]*data_manage.EdbDataList)
+		var startDate, endDate string
+		for _, v := range edbDataList {
+			// 判断是否为基准指标
+			if v.EdbInfoId == tmpConfig.StandardEdbInfoId {
+				if dataList, ok := v.DataList.([]*data_manage.EdbDataList); ok {
+					startDate = dataList[0].DataTime
+					endDate = dataList[len(dataList)-1].DataTime
+					for _, dataObject := range dataList {
+						standardIndexMap[dataObject.DataTime] = dataObject
+					}
+				}
+				break
+			}
+		}
+		strategy, err := area_graph.CreateStrategy(tmpConfig.NullDealWay)
+		if err != nil {
+			return err, "创建空值处理器失败"
+		}
+		err = strategy.Deal(tmpConfig, edbDataList, standardIndexMap, startDate, endDate)
+		if err != nil {
+			return err, err.Error()
+		}
+
+		// 时间戳处理
+		for _, mapping := range edbDataList {
+			if dataList, ok := mapping.DataList.([]*data_manage.EdbDataList); ok {
+				for _, dataInfo := range dataList {
+					toFormatTime := utils.StringToFormatTime(dataInfo.DataTime, utils.FormatDate)
+					dataInfo.DataTimestamp = toFormatTime.UnixMilli()
+				}
+			}
+		}
+	}
+
+	return nil, ""
+}
+
 // ChartInfoDetailV2
 // @Title 获取图表详情
 // @Description 获取图表详情接口
@@ -1521,7 +1589,7 @@ func (this *ChartInfoController) ChartInfoDetailV2() {
 	}
 	chartInfo, err := data_manage.GetChartInfoViewById(chartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "该图表已删除,自动查看下一图表"
 			br.ErrMsg = "该图表已删除,自动查看下一图表,Err:" + err.Error()
 			br.Ret = 406
@@ -1632,7 +1700,7 @@ func (this *ChartInfoController) ChartInfoDetailV2() {
 	extraConfigStr := chartInfo.ExtraConfig
 	// 柱方图的一些配置
 	var barConfig data_manage.BarChartInfoReq
-	if chartInfo != nil && chartInfo.ChartType == 7 {
+	if chartInfo != nil && chartInfo.ChartInfoId > 0 && chartInfo.ChartType == 7 {
 		if chartInfo.BarConfig == `` {
 			br.Msg = "柱方图未配置"
 			br.ErrMsg = "柱方图未配置"
@@ -1672,7 +1740,7 @@ func (this *ChartInfoController) ChartInfoDetailV2() {
 		if len(warnEdbList) > 0 {
 			chartInfo.WarnMsg = `图表引用指标异常,异常指标:` + strings.Join(warnEdbList, ",")
 		}
-		if chartInfoId > 0 && chartInfo != nil {
+		if chartInfoId > 0 && chartInfo != nil && chartInfo.ChartInfoId > 0 {
 			//判断是否加入我的图库
 			{
 				var myChartCondition string
@@ -1683,7 +1751,7 @@ func (this *ChartInfoController) ChartInfoDetailV2() {
 				myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 				myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					br.Msg = "获取失败"
 					br.ErrMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 					return
@@ -2116,7 +2184,7 @@ func (this *ChartInfoController) ChartInfoSearch() {
 	for _, v := range keyWordArr {
 		v = strings.Replace(v, " ", "%", -1)
 		newSearchList, err := data_manage.ChartInfoSearchByKeyWord(v, showSysId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 			return
@@ -2236,7 +2304,7 @@ func (this *ChartInfoController) ChartInfoSearchByEs() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -2253,7 +2321,7 @@ func (this *ChartInfoController) ChartInfoSearchByEs() {
 		isEs = true
 	} else {
 		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, []int{utils.CHART_SOURCE_DEFAULT}, noPermissionChartIdList, startSize, pageSize)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 			return
@@ -2407,7 +2475,7 @@ func (this *EdbInfoController) ChartInfoRefresh() {
 		chartInfo, err = data_manage.GetChartInfoByUniqueCode(uniqueCode)
 	}
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,无需刷新"
 			br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 			return
@@ -2526,7 +2594,7 @@ func (this *ChartInfoController) ChartInfoDetailFromUniqueCode() {
 	status := true
 	chartInfo, err := data_manage.GetChartInfoViewByUniqueCode(uniqueCode)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			status = false
 		} else {
 			br.Msg = "获取失败"
@@ -2596,7 +2664,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 				myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 				myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					msg = "获取失败"
 					errMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 					return
@@ -2774,7 +2842,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 	extraConfigStr := chartInfo.ExtraConfig //图表额外数据参数
 	var barConfig data_manage.BarChartInfoReq
 	// 柱方图的一些配置
-	if chartInfo != nil && chartInfo.ChartType == 7 {
+	if chartInfo != nil && chartInfo.ChartInfoId > 0 && chartInfo.ChartType == 7 {
 		if chartInfo.BarConfig == `` {
 			msg = "柱方图未配置"
 			errMsg = "柱方图未配置"
@@ -2820,11 +2888,22 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 	*/
 
 	chartViewClassify, _ := data_manage.GetChartClassifyViewById(chartInfo.ChartClassifyId)
-	if chartViewClassify != nil {
+	if chartViewClassify != nil && chartViewClassify.ChartClassifyId > 0 {
 		chartClassifyParent, _ := data_manage.GetChartClassifyViewById(chartClassify.ParentId)
 		chartInfo.ChartClassify = append(chartInfo.ChartClassify, chartClassifyParent)
 	}
 	chartInfo.ChartClassify = append(chartInfo.ChartClassify, chartViewClassify)
+
+	// 面积图 面积堆积 数据处理
+	if chartType == utils.CHART_TYPE_AREA {
+		err, errMsg = fillAreaGraphData(extraConfigStr, edbList)
+		if err != nil {
+			msg = "获取失败"
+			errMsg = "获取面积图数据失败,Err:" + err.Error()
+			return
+		}
+	}
+
 	resp.EdbInfoList = edbList
 	//判断是否需要展示英文标识
 	chartInfo.IsEnChart = data.CheckIsEnChart(chartInfo.ChartNameEn, edbList, chartInfo.Source, chartInfo.ChartType)
@@ -3109,7 +3188,7 @@ func (this *ChartInfoController) CopyChartInfo() {
 	}
 	chartClassify, err := data_manage.GetChartClassifyById(req.ChartClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在"
 			br.ErrMsg = "分类不存在"
 			return
@@ -3217,7 +3296,10 @@ func (this *ChartInfoController) CopyChartInfo() {
 	{
 		mapList := make([]*data_manage.ChartEdbMapping, 0)
 		for _, v := range edbMappingList {
+			// windows server环境这里得加个延时,不然生成时间戳都是一样的
+			time.Sleep(100 * time.Millisecond)
 			timestamp := strconv.FormatInt(time.Now().UnixNano(), 10)
+			//utils.FileLog.Info("IndexCode: %s, UniqueCode: %s", v.EdbInfoId, utils.MD5(utils.CHART_PREFIX+"_"+timestamp))
 			mapItem := &data_manage.ChartEdbMapping{
 				//ChartEdbMappingId: 0,
 				ChartInfoId:   chartInfo.ChartInfoId,
@@ -3235,7 +3317,7 @@ func (this *ChartInfoController) CopyChartInfo() {
 				ChartStyle:    v.ChartStyle,
 				ChartColor:    v.ChartColor,
 				ChartWidth:    v.ChartWidth,
-				Source:        v.Source,
+				Source:        oldChartInfo.Source,
 				EdbAliasName:  v.EdbAliasName,
 				IsConvert:     v.IsConvert,
 				ConvertType:   v.ConvertType,
@@ -3772,10 +3854,6 @@ func (this *EdbInfoController) GetBatchChartRefreshResult() {
 //	fmt.Println("end")
 //}
 
-//func init() {
-//	data.AddAllChartInfo()
-//}
-
 // 截面散点示例数据
 //func init() {
 //
@@ -4081,7 +4159,7 @@ func (this *ChartInfoController) ChartInfoConvertDetail() {
 	if chartInfoId > 0 {
 		chartInfo, err = data_manage.GetChartInfoViewById(chartInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "该图表已删除,自动查看下一图表"
 				br.ErrMsg = "该图表已删除,自动查看下一图表,Err:" + err.Error()
 				br.Ret = 406
@@ -4169,7 +4247,7 @@ func (this *ChartInfoController) ChartInfoConvertDetail() {
 		extraConfigStr := chartInfo.ExtraConfig
 		// 柱方图的一些配置
 		var barConfig data_manage.BarChartInfoReq
-		if chartInfo != nil && chartInfo.ChartType == 7 {
+		if chartInfo != nil && chartInfo.ChartInfoId > 0 && chartInfo.ChartType == 7 {
 			if chartInfo.BarConfig == `` {
 				br.Msg = "柱方图未配置"
 				br.ErrMsg = "柱方图未配置"
@@ -4230,7 +4308,7 @@ func (this *ChartInfoController) ChartInfoConvertDetail() {
 		if len(warnEdbList) > 0 {
 			chartInfo.WarnMsg = `图表引用指标异常,异常指标:` + strings.Join(warnEdbList, ",")
 		}
-		if chartInfoId > 0 && chartInfo != nil {
+		if chartInfoId > 0 && chartInfo != nil && chartInfo.ChartInfoId > 0 {
 			//判断是否加入我的图库
 			{
 				var myChartCondition string
@@ -4241,7 +4319,7 @@ func (this *ChartInfoController) ChartInfoConvertDetail() {
 				myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 				myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					br.Msg = "获取失败"
 					br.ErrMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 					return
@@ -4643,7 +4721,7 @@ func (this *ChartInfoController) ChartList() {
 	if len(chartClassifyIdsStr) > 0 {
 		if !subClassify {
 			chartClassifyId, err := data_manage.GetChartClassifyByIdsNoSubClassify(chartClassifyIds)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "获取图表信息失败"
 				br.ErrMsg = "获取信息失败,GetChartClassify,Err:" + err.Error()
 				return
@@ -4723,7 +4801,7 @@ func (this *ChartInfoController) ChartList() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -4741,7 +4819,7 @@ func (this *ChartInfoController) ChartList() {
 
 	//获取图表信息
 	list, err := data_manage.GetChartListByCondition(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
@@ -4749,7 +4827,7 @@ func (this *ChartInfoController) ChartList() {
 	}
 
 	myChartList, err := data_manage.GetMyChartListByAdminId(sysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取我的图表信息失败,Err:" + err.Error()
 		return
@@ -4841,7 +4919,7 @@ func (this *ChartInfoController) ChartList() {
 	}
 
 	resp := new(data_manage.ChartListResp)
-	if list == nil || len(list) <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || len(list) <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		items := make([]*data_manage.ChartInfoView, 0)
 		resp.Paging = page
 		resp.List = items
@@ -4852,7 +4930,7 @@ func (this *ChartInfoController) ChartList() {
 	}
 
 	dataCount, err := data_manage.GetChartListCountByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取指标信息失败"
 		br.ErrMsg = "获取指标数据总数失败,Err:" + err.Error()
 		return
@@ -4920,7 +4998,7 @@ func (this *ChartInfoController) ModifyChartList() {
 		if len(chartClassifyIds) > 0 {
 			if !req.SubClassify {
 				chartClassifyId, err := data_manage.GetChartClassifyByIdsNoSubClassify(chartClassifyIds)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					br.Msg = "获取图表信息失败"
 					br.ErrMsg = "获取信息失败,GetChartClassify,Err:" + err.Error()
 					return

+ 7 - 4
controllers/data_manage/chart_theme.go

@@ -207,6 +207,9 @@ func (c *ChartThemeController) GetThemePreviewData() {
 		chartInfo.LeftMax = "4000"
 		extraConfigStr = `{"DateConfList":[],"IsHeap":0,"XDataList":[{"Name":"内销"},{"Name":"出口"},{"Name":"销量"},{"Name":"产量"}],"UnitList":{"LeftName":"万台","RightName":"%","RightTwoName":""},"BaseChartSeriesName":"增量","SortType":0,"SeriesList":[{"ChartSeriesId":0,"SeriesName":"增量","ChartStyle":"column","ChartColor":"rgba(0, 0, 255, 1)","ChartWidth":1,"IsPoint":0,"IsNumber":0,"IsAxis":1,"EdbInfoList":[{"ChartSeriesEdbMappingId":0,"ChartSeriesId":0,"EdbInfoId":19,"DateConfName":"","DateConfType":0,"DateConf":{"MoveForward":0,"DateChange":[]}},{"ChartSeriesEdbMappingId":0,"ChartSeriesId":0,"EdbInfoId":20,"DateConfName":"","DateConfType":0,"DateConf":{"MoveForward":0,"DateChange":[]}},{"ChartSeriesEdbMappingId":0,"ChartSeriesId":0,"EdbInfoId":21,"DateConfName":"","DateConfType":0,"DateConf":{"MoveForward":0,"DateChange":[]}},{"ChartSeriesEdbMappingId":0,"ChartSeriesId":0,"EdbInfoId":22,"DateConfName":"","DateConfType":0,"DateConf":{"MoveForward":0,"DateChange":[]}}]},{"ChartSeriesId":0,"SeriesName":"增速","ChartStyle":"spline","ChartColor":"rgba(255, 0, 200, 1)","ChartWidth":1,"IsPoint":0,"IsNumber":0,"IsAxis":0,"EdbInfoList":[{"ChartSeriesEdbMappingId":0,"ChartSeriesId":0,"EdbInfoId":23,"DateConfName":"","DateConfType":0,"DateConf":{"MoveForward":0,"DateChange":[]}},{"ChartSeriesEdbMappingId":0,"ChartSeriesId":0,"EdbInfoId":24,"DateConfName":"","DateConfType":0,"DateConf":{"MoveForward":0,"DateChange":[]}},{"ChartSeriesEdbMappingId":0,"ChartSeriesId":0,"EdbInfoId":25,"DateConfName":"","DateConfType":0,"DateConf":{"MoveForward":0,"DateChange":[]}},{"ChartSeriesEdbMappingId":0,"ChartSeriesId":0,"EdbInfoId":26,"DateConfName":"","DateConfType":0,"DateConf":{"MoveForward":0,"DateChange":[]}}]}]}`
 		chartInfo.ChartName = "图表标题"
+	case utils.CHART_TYPE_AREA: // 曲线图
+		edbInfoIdList = []int{25, 26}
+		chartInfo.ChartName = "面积图"
 	default:
 		br.Msg = "暂不支持该类型"
 		br.IsSendEmail = false
@@ -401,7 +404,7 @@ func (c *ChartThemeController) Edit() {
 	// 获取配置
 	chartTheme, err := chart_theme.GetChartThemeId(req.ChartThemeId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "主题不存在或已删除"
 			br.ErrMsg = "主题不存在或已删除"
 			br.IsSendEmail = false
@@ -471,7 +474,7 @@ func (c *ChartThemeController) Delete() {
 	// 获取配置
 	chartTheme, err := chart_theme.GetChartThemeId(req.ChartThemeId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "主题不存在或已删除"
 			br.ErrMsg = "主题不存在或已删除"
 			br.IsSendEmail = false
@@ -559,7 +562,7 @@ func (c *ChartThemeController) SetDefaultTheme() {
 	// 获取图表配置
 	chartTheme, err := chart_theme.GetChartThemeId(req.ChartThemeId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "主题不存在或已删除"
 			br.ErrMsg = "主题不存在或已删除"
 			br.IsSendEmail = false
@@ -573,7 +576,7 @@ func (c *ChartThemeController) SetDefaultTheme() {
 	// 获取图表类型
 	chartThemeType, err := chart_theme.GetChartThemeTypeById(req.ChartThemeTypeId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "获取图表类型不存在或已删除"
 			br.ErrMsg = "获取图表类型不存在或已删除"
 			br.IsSendEmail = false

+ 8 - 8
controllers/data_manage/clarksons_data.go

@@ -179,7 +179,7 @@ func (this *ClarksonsDataController) EditClassify() {
 	}
 	classify, err := data_manage.GetClarksonsClassifyById(req.BaseFromClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在"
 			return
 		}
@@ -271,7 +271,7 @@ func (this *ClarksonsDataController) IndexList() {
 	}()
 	classifyId, _ := this.GetInt("BaseFromClassifyId", 0)
 	indexList, err := data_manage.GetClarksonsIndexBaseInfoByClassifyId(classifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 		return
@@ -411,7 +411,7 @@ func (this *ClarksonsDataController) SingleData() {
 		return
 	}
 	edbInfo, err := data_manage.GetEdbInfoByEdbCode(utils.DATA_SOURCE_CLARKSONS, indexInfo.IndexCode)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取指标数据失败"
 		br.ErrMsg = "获取指标库数据失败,Err:" + err.Error()
 		return
@@ -613,7 +613,7 @@ func (this *ClarksonsDataController) MoveClarksonsData() {
 //
 //	_, err = data_manage.GetClarksonsIndexByIndexCode(req.EdbCode)
 //	if err != nil {
-//		if err.Error() == utils.ErrNoRow() {
+//		if utils.IsErrNoRow(err) {
 //			br.Msg = "指标不存在"
 //			return
 //		}
@@ -824,7 +824,7 @@ func (c *ClarksonsDataController) NameCheck() {
 			EdbName: v.EdbName,
 		})
 		dataItems, err := data_manage.GetEdbDataAllByEdbCode(v.EdbCode, utils.DATA_SOURCE_CLARKSONS, 0, utils.EDB_DATA_LIMIT)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取克拉克森已存在信息失败,Err:" + err.Error()
 			return
@@ -1539,7 +1539,7 @@ func (this *ClarksonsDataController) ClarksonsData() {
 		product.ModifyTime = v.ModifyTime
 
 		modifyTime, err := data_manage.GetClarksonsIndexLatestDate(v.IndexCode)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取更新时间失败"
 			br.ErrMsg = "获取更新时间失败,Err:" + err.Error()
 			return
@@ -1605,7 +1605,7 @@ func (this *ClarksonsDataController) IndexPageList() {
 		}
 		total = tmpTotal
 		tmpIndexList, err := data_manage.GetClarksonsIndexByPage(startSize, pageSize)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 			return
@@ -1633,7 +1633,7 @@ func (this *ClarksonsDataController) IndexPageList() {
 		}
 		total = tmpTotal
 		tmpIndexList, err := data_manage.GetClarksonsIndexByClassifyId(classifyIds, startSize, pageSize)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 			return

+ 5 - 5
controllers/data_manage/com_trade.go

@@ -29,7 +29,7 @@ func (this *EdbInfoController) ComTradeCountryList() {
 	}
 
 	list, err := data_manage.GetComTradeCountryItemAll()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -161,14 +161,14 @@ func (this *EdbInfoController) ComTradeDataList() {
 	sortStr = fmt.Sprintf("%s %s,modify_time desc ", sortParam, sortType)
 
 	total, err := data_manage.GetComTradeListCount(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	list, err := data_manage.GetComTradeList(condition, pars, startSize, pageSize, sortStr)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -178,7 +178,7 @@ func (this *EdbInfoController) ComTradeDataList() {
 	lastUpdateTimeStr := ``
 	// 获取用到的指标信息
 	comTradeList, err := data_manage.GetAllComTradeIndexList()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -247,7 +247,7 @@ func (this *EdbInfoController) ComTradeList() {
 	}
 
 	list, err := data_manage.GetComTradeIndexList(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return

+ 28 - 30
controllers/data_manage/correlation/correlation_chart_classify.go

@@ -62,7 +62,7 @@ func (this *CorrelationChartClassifyController) ChartClassifyList() {
 	nodeAll := make([]*data_manage.ChartClassifyItems, 0)
 	// 查询分类节点
 	rootList, err := data_manage.GetChartClassifyByParentId(parentId, utils.CHART_SOURCE_CORRELATION)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -155,19 +155,19 @@ func (this *CorrelationChartClassifyController) ChartClassifyList() {
 // getChartClassifyListForMe 获取我创建的图表
 func getChartClassifyListForMe(adminInfo system.Admin, resp *data_manage.ChartClassifyListResp) (errMsg string, err error) {
 	rootList, err := data_manage.GetChartClassifyByParentId(0, utils.CHART_SOURCE_CORRELATION)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
 
 	classifyAll, err := data_manage.GetChartClassifyAll(utils.CHART_SOURCE_CORRELATION)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
 
 	allChartInfo, err := data_manage.GetChartInfoByAdminId([]int{utils.CHART_SOURCE_CORRELATION, utils.CHART_SOURCE_CORRELATION}, adminInfo.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
@@ -367,7 +367,7 @@ func (this *CorrelationChartClassifyController) DeleteChartClassifyCheck() {
 
 	if deleteStatus != 1 && req.ChartInfoId == 0 {
 		classifyCount, err := data_manage.GetChartClassifyCountByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "分类下是否含有图表失败,Err:" + err.Error()
 			return
@@ -429,7 +429,7 @@ func (this *CorrelationChartClassifyController) DeleteChartClassify() {
 	if req.ChartClassifyId > 0 && req.ChartInfoId == 0 {
 		//判断是否含有指标
 		count, err := data_manage.GetChartInfoCountByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
 			return
@@ -449,11 +449,12 @@ func (this *CorrelationChartClassifyController) DeleteChartClassify() {
 		}
 	}
 	resp := new(data_manage.AddChartInfoResp)
+
 	//删除图表
 	if req.ChartInfoId > 0 {
 		chartInfo, err := data_manage.GetChartInfoById(req.ChartInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "图表已删除,请刷新页面"
 				br.ErrMsg = "指标不存在,Err:" + err.Error()
 				return
@@ -492,13 +493,23 @@ func (this *CorrelationChartClassifyController) DeleteChartClassify() {
 		}
 
 		source := chartInfo.Source // 相关性图表(滚动相关性)
-		//删除图表及关联指标
+
+		// 删除图表及关联指标
 		err = data_manage.DeleteChartInfoAndData(chartInfo.ChartInfoId)
 		if err != nil {
 			br.Msg = "删除失败"
 			br.ErrMsg = "删除失败,Err:" + err.Error()
 			return
 		}
+
+		// 删除图表关联
+		e = correlationServ.RemoveCorrelationRelate(chartInfo.ChartInfoId)
+		if e != nil {
+			br.Msg = "删除失败"
+			br.ErrMsg = fmt.Sprintf("删除相关性图表关联失败, %v", e)
+			return
+		}
+
 		//删除ES
 		{
 			go data.EsDeleteChartInfo(chartInfo.ChartInfoId)
@@ -507,16 +518,14 @@ func (this *CorrelationChartClassifyController) DeleteChartClassify() {
 			go data.EsDeleteMyChartInfoByMyChartIds(myIds)
 		}
 
+		// 删除后定位至其他图(不知道原需求具体定位到哪张...修复的时候只是多加上了个source条件)
 		var condition string
 		var pars []interface{}
-		condition += " AND chart_classify_id=? AND source = ? "
-		pars = append(pars, chartInfo.ChartClassifyId, source)
-
-		condition += " AND chart_info_id>? ORDER BY create_time ASC LIMIT 1 "
-		pars = append(pars, req.ChartInfoId)
+		condition += ` AND chart_classify_id = ? AND source = ? AND chart_info_id > ? ORDER BY create_time ASC LIMIT 1`
+		pars = append(pars, chartInfo.ChartClassifyId, source, req.ChartInfoId)
 
 		nextItem, err := data_manage.GetChartInfoByCondition(condition, pars)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
 			return
@@ -529,21 +538,18 @@ func (this *CorrelationChartClassifyController) DeleteChartClassify() {
 			var condition string
 			var pars []interface{}
 
-			condition += " AND level=1 "
-			//pars = append(pars, chartInfo.ChartClassifyId)
-
-			condition += " AND chart_classify_id>? ORDER BY chart_classify_id ASC LIMIT 1 "
-			pars = append(pars, chartInfo.ChartClassifyId)
+			condition += ` AND level = 1 AND chart_classify_id > ? AND source = ? ORDER BY chart_classify_id ASC LIMIT 1`
+			pars = append(pars, chartInfo.ChartClassifyId, source)
 
 			classifyItem, err := data_manage.GetChartClassifyByCondition(condition, pars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "删除失败"
 				br.ErrMsg = "获取下一级图库分类信息失败,Err:" + err.Error()
 				return
 			}
 			if classifyItem != nil {
-				nextItem, err = data_manage.GetNextChartInfo(chartInfo.ChartClassifyId)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				nextItem, err = data_manage.GetNextChartByClassifyIdAndSource(chartInfo.ChartClassifyId, source)
+				if err != nil && !utils.IsErrNoRow(err) {
 					br.Msg = "删除失败"
 					br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
 					return
@@ -555,14 +561,6 @@ func (this *CorrelationChartClassifyController) DeleteChartClassify() {
 			}
 		}
 
-		// 删除图表关联
-		e = correlationServ.RemoveCorrelationRelate(chartInfo.ChartInfoId)
-		if e != nil {
-			br.Msg = "删除失败"
-			br.ErrMsg = fmt.Sprintf("删除相关性图表关联失败, %v", e)
-			return
-		}
-
 		//新增操作日志
 		{
 			chartLog := new(data_manage.ChartInfoLog)

+ 28 - 28
controllers/data_manage/correlation/correlation_chart_info.go

@@ -335,7 +335,7 @@ func (this *CorrelationChartInfoController) Move() {
 	if chartInfo.ChartClassifyId != req.ChartClassifyId {
 		//查询需要修改的分类下是否存在同一个图表名称
 		tmpChartInfo, tmpErr := data_manage.GetChartInfoByClassifyIdAndName(req.ChartClassifyId, chartInfo.ChartName)
-		if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
+		if tmpErr != nil && !utils.IsErrNoRow(tmpErr) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "移动失败,Err:" + tmpErr.Error()
 			return
@@ -394,7 +394,7 @@ func (this *CorrelationChartInfoController) Move() {
 
 	} else {
 		firstClassify, err := data_manage.GetFirstChartInfoByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "获取获取当前父级分类下的排序第一条的分类信息失败,Err:" + err.Error()
 			return
@@ -510,7 +510,7 @@ func (this *CorrelationChartInfoController) List() {
 
 	if chartClassifyId > 0 {
 		chartClassifyId, err := data_manage.GetChartClassify(chartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取图表信息失败"
 			br.ErrMsg = "获取信息失败,GetChartClassify,Err:" + err.Error()
 			return
@@ -550,7 +550,7 @@ func (this *CorrelationChartInfoController) List() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -568,7 +568,7 @@ func (this *CorrelationChartInfoController) List() {
 
 	//获取图表信息
 	list, err := data_manage.GetChartListByCondition(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
@@ -576,7 +576,7 @@ func (this *CorrelationChartInfoController) List() {
 	}
 
 	myChartList, err := data_manage.GetMyChartListByAdminId(sysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取我的图表信息失败,Err:" + err.Error()
 		return
@@ -620,7 +620,7 @@ func (this *CorrelationChartInfoController) List() {
 	}
 
 	resp := new(data_manage.ChartListResp)
-	if list == nil || len(list) <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || len(list) <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		items := make([]*data_manage.ChartInfoView, 0)
 		resp.Paging = page
 		resp.List = items
@@ -631,7 +631,7 @@ func (this *CorrelationChartInfoController) List() {
 	}
 
 	dataCount, err := data_manage.GetChartListCountByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取指标信息失败"
 		br.ErrMsg = "获取指标数据总数失败,Err:" + err.Error()
 		return
@@ -682,7 +682,7 @@ func (this *CorrelationChartInfoController) Detail() {
 	chartInfo := new(data_manage.ChartInfoView)
 	chartInfo, err = data_manage.GetChartInfoViewById(chartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图被删除,请刷新页面"
 			br.ErrMsg = "图被删除,请刷新页面,Err:" + err.Error()
 			return
@@ -807,7 +807,7 @@ func (this *CorrelationChartInfoController) Detail() {
 			myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 			myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 				return
@@ -963,7 +963,7 @@ func (this *CorrelationChartInfoController) DetailFromUniqueCode() {
 	status := true
 	chartInfo, err := data_manage.GetChartInfoViewByUniqueCode(uniqueCode)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			status = false
 		} else {
 			br.Msg = "获取失败"
@@ -1001,7 +1001,7 @@ func (this *CorrelationChartInfoController) DetailFromUniqueCode() {
 					myCond += ` AND a.chart_info_id=? `
 					myPars = append(myPars, chartInfo.ChartInfoId)
 					myList, err := data_manage.GetMyChartByCondition(myCond, myPars)
-					if err != nil && err.Error() != utils.ErrNoRow() {
+					if err != nil && !utils.IsErrNoRow(err) {
 						br.Msg = "获取失败"
 						br.ErrMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 						return
@@ -1072,7 +1072,7 @@ func (this *CorrelationChartInfoController) Refresh() {
 		chartInfo, err = data_manage.GetChartInfoByUniqueCode(uniqueCode)
 	}
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,无需刷新"
 			br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 			return
@@ -1191,7 +1191,7 @@ func (this *CorrelationChartInfoController) Copy() {
 
 		_, e = data_manage.GetChartClassifyById(req.ChartClassifyId)
 		if e != nil {
-			if e.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(e) {
 				br.Msg = "分类不存在"
 				return
 			}
@@ -1204,7 +1204,7 @@ func (this *CorrelationChartInfoController) Copy() {
 	// 图表信息
 	originChart, e := data_manage.GetChartInfoById(req.ChartInfoId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "原图表不存在"
 			return
 		}
@@ -1221,7 +1221,7 @@ func (this *CorrelationChartInfoController) Copy() {
 	// 相关性图
 	originCorrelate := new(data_manage.ChartInfoCorrelation)
 	if e = originCorrelate.GetItemById(req.ChartInfoId); e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "原相关性图表不存在"
 			return
 		}
@@ -1234,7 +1234,7 @@ func (this *CorrelationChartInfoController) Copy() {
 	chartInfo := new(data_manage.ChartInfo)
 	if originCorrelate.AnalysisMode != 1 {
 		multipleGraphConfigChartMapping, err := data_manage.GetMultipleGraphConfigChartMappingByChartId(req.ChartInfoId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = `保存失败`
 			br.ErrMsg = "获取配置与图表的关联关系失败,ERR:" + err.Error()
 			return
@@ -1503,7 +1503,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 				myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 				myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					msg = "获取失败"
 					errMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 					return
@@ -1724,7 +1724,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 			myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 			myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				msg = "获取失败"
 				errMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 				return
@@ -1840,7 +1840,7 @@ func (this *CorrelationChartInfoController) EnInfoEdit() {
 	pars = append(pars, req.ChartInfoId, req.ChartNameEn, utils.CHART_SOURCE_CORRELATION)
 	existItem, err := data_manage.GetChartInfoByCondition(condition, pars)
 	if err != nil {
-		if err.Error() != utils.ErrNoRow() {
+		if !utils.IsErrNoRow(err) {
 			br.Msg = "判断英文图表名称是否存在失败"
 			br.ErrMsg = "判断英文图表名称是否存在失败,Err:" + err.Error()
 			return
@@ -1953,7 +1953,7 @@ func (this *CorrelationChartInfoController) SearchByEs() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -1967,7 +1967,7 @@ func (this *CorrelationChartInfoController) SearchByEs() {
 		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 	} else {
 		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 			return
@@ -2042,7 +2042,7 @@ func (this *CorrelationChartInfoController) Newest() {
 		this.ServeJSON()
 	}()
 	item, err := data_manage.GetChartInfoByNewest(utils.CHART_SOURCE_CORRELATION)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取最新图表失败"
 		br.ErrMsg = "获取最新图表失败,Err:" + err.Error()
 		return
@@ -2115,7 +2115,7 @@ func (this *CorrelationChartInfoController) BaseInfoEdit() {
 	pars = append(pars, req.ChartName)
 	existItem, err := data_manage.GetChartInfoByCondition(condition, pars)
 	if err != nil {
-		if err.Error() != utils.ErrNoRow() {
+		if !utils.IsErrNoRow(err) {
 			br.Msg = "判断英文图表名称是否存在失败"
 			br.ErrMsg = "判断英文图表名称是否存在失败,Err:" + err.Error()
 			return
@@ -2307,7 +2307,7 @@ func (this *CorrelationChartInfoController) MultiFactorAdd() {
 
 		_, e = data_manage.GetChartClassifyById(req.ClassifyId)
 		if e != nil {
-			if e.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(e) {
 				br.Msg = "分类不存在"
 				return
 			}
@@ -2663,7 +2663,7 @@ func (this *CorrelationChartInfoController) MultiFactorEdit() {
 
 	chartInfo, e := data_manage.GetChartInfoById(req.ChartInfoId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "图表已被删除, 请刷新页面"
 			return
 		}
@@ -2715,7 +2715,7 @@ func (this *CorrelationChartInfoController) MultiFactorEdit() {
 
 		_, e = data_manage.GetChartClassifyById(req.ClassifyId)
 		if e != nil {
-			if e.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(e) {
 				br.Msg = "分类不存在"
 				return
 			}
@@ -2916,7 +2916,7 @@ func (this *CorrelationChartInfoController) MultiFactorDetail() {
 
 	chartInfo, e := data_manage.GetChartInfoByUniqueCode(uniqueCode)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "图表已被删除, 请刷新页面"
 			return
 		}

+ 22 - 22
controllers/data_manage/cross_variety/chart_info.go

@@ -84,7 +84,7 @@ func (c *ChartInfoController) List() {
 
 	if chartClassifyId > 0 {
 		chartClassifyId, err := data_manage.GetChartClassify(chartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取图表信息失败"
 			br.ErrMsg = "获取信息失败,GetChartClassify,Err:" + err.Error()
 			return
@@ -124,7 +124,7 @@ func (c *ChartInfoController) List() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(c.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -142,7 +142,7 @@ func (c *ChartInfoController) List() {
 
 	//获取图表信息
 	list, err := data_manage.GetChartListByCondition(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
@@ -150,7 +150,7 @@ func (c *ChartInfoController) List() {
 	}
 
 	myChartList, err := data_manage.GetMyChartListByAdminId(sysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取我的图表信息失败,Err:" + err.Error()
 		return
@@ -194,7 +194,7 @@ func (c *ChartInfoController) List() {
 	}
 
 	resp := new(data_manage.ChartListResp)
-	if list == nil || len(list) <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || len(list) <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		items := make([]*data_manage.ChartInfoView, 0)
 		resp.Paging = page
 		resp.List = items
@@ -205,7 +205,7 @@ func (c *ChartInfoController) List() {
 	}
 
 	dataCount, err := data_manage.GetChartListCountByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取指标信息失败"
 		br.ErrMsg = "获取指标数据总数失败,Err:" + err.Error()
 		return
@@ -491,7 +491,7 @@ func (c *ChartInfoController) Detail() {
 	chartInfo := new(data_manage.ChartInfoView)
 	chartInfo, err = data_manage.GetChartInfoViewById(chartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图被删除,请刷新页面"
 			br.ErrMsg = "图被删除,请刷新页面,Err:" + err.Error()
 			return
@@ -584,7 +584,7 @@ func (c *ChartInfoController) Detail() {
 			myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 			myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 				return
@@ -703,7 +703,7 @@ func (c *ChartInfoController) Relation() {
 	chartInfo := new(data_manage.ChartInfoView)
 	chartInfo, err = data_manage.GetChartInfoViewById(chartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图被删除,请刷新页面"
 			br.ErrMsg = "图被删除,请刷新页面,Err:" + err.Error()
 			return
@@ -973,7 +973,7 @@ func (c *ChartInfoController) Move() {
 
 	} else {
 		firstClassify, err := data_manage.GetFirstChartInfoByClassifyId(chartInfo.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "获取获取当前父级分类下的排序第一条的分类信息失败,Err:" + err.Error()
 			return
@@ -1075,7 +1075,7 @@ func (c *ChartInfoController) Refresh() {
 		chartInfo, err = data_manage.GetChartInfoByUniqueCode(uniqueCode)
 	}
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,无需刷新"
 			br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 			return
@@ -1160,7 +1160,7 @@ func (c *ChartInfoController) EnInfoEdit() {
 	//判断指标名称是否存在
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,请刷新页面"
 			br.ErrMsg = "图表已被删除,请刷新页面"
 			return
@@ -1279,7 +1279,7 @@ func (c *ChartInfoController) DeleteChart() {
 	//删除图表
 	chartInfo, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已删除,请刷新页面"
 			br.ErrMsg = "指标不存在,Err:" + err.Error()
 			return
@@ -1342,7 +1342,7 @@ func (c *ChartInfoController) DeleteChart() {
 	pars = append(pars, req.ChartInfoId)
 
 	nextItem, err := data_manage.GetChartInfoByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "删除失败"
 		br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
 		return
@@ -1362,14 +1362,14 @@ func (c *ChartInfoController) DeleteChart() {
 		tmpPars = append(tmpPars, chartInfo.ChartClassifyId)
 
 		classifyItem, err := data_manage.GetChartClassifyByCondition(tmpCondition, tmpPars)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "获取下一级图库分类信息失败,Err:" + err.Error()
 			return
 		}
 		if classifyItem != nil {
 			nextItem, err = data_manage.GetNextChartInfo(chartInfo.ChartClassifyId)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "删除失败"
 				br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
 				return
@@ -1460,7 +1460,7 @@ func (c *ChartInfoController) SearchByEs() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(c.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -1474,7 +1474,7 @@ func (c *ChartInfoController) SearchByEs() {
 		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 	} else {
 		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 			return
@@ -1558,7 +1558,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 				myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 				myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					msg = "获取失败"
 					errMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 					return
@@ -1701,7 +1701,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 			myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 			myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				msg = "获取失败"
 				errMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 				return
@@ -1796,7 +1796,7 @@ func (c *ChartInfoController) Save() {
 
 	chartItem, e := data_manage.GetChartInfoById(req.ChartInfoId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "图表已被删除, 请刷新页面"
 			return
 		}
@@ -1883,7 +1883,7 @@ func (c *ChartInfoController) BaseInfoEdit() {
 	//判断指标名称是否存在
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,请刷新页面"
 			br.ErrMsg = "图表已被删除,请刷新页面"
 			return

+ 10 - 10
controllers/data_manage/cross_variety/classify.go

@@ -36,7 +36,7 @@ func (c *ClassifyController) List() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(c.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -54,14 +54,14 @@ func (c *ClassifyController) List() {
 	}
 
 	rootList, err := data_manage.GetChartClassifyByParentId(0, utils.CHART_SOURCE_CROSS_HEDGING)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	allChartInfo, err := data_manage.GetChartInfoAll([]int{source})
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 		return
@@ -195,7 +195,7 @@ func (c *ClassifyController) DeleteChartClassifyCheck() {
 
 	if deleteStatus != 1 && req.ChartInfoId == 0 {
 		classifyCount, err := data_manage.GetChartClassifyCountByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "分类下是否含有图表失败,Err:" + err.Error()
 			return
@@ -257,7 +257,7 @@ func (c *ClassifyController) DeleteChartClassify() {
 	if req.ChartClassifyId > 0 && req.ChartInfoId == 0 {
 		//判断是否含有指标
 		count, err := data_manage.GetChartInfoCountByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
 			return
@@ -281,7 +281,7 @@ func (c *ClassifyController) DeleteChartClassify() {
 	if req.ChartInfoId > 0 {
 		chartInfo, err := data_manage.GetChartInfoById(req.ChartInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "图表已删除,请刷新页面"
 				br.ErrMsg = "指标不存在,Err:" + err.Error()
 				return
@@ -344,7 +344,7 @@ func (c *ClassifyController) DeleteChartClassify() {
 		pars = append(pars, req.ChartInfoId)
 
 		nextItem, err := data_manage.GetChartInfoByCondition(condition, pars)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
 			return
@@ -364,14 +364,14 @@ func (c *ClassifyController) DeleteChartClassify() {
 			pars = append(pars, chartInfo.ChartClassifyId)
 
 			classifyItem, err := data_manage.GetChartClassifyByCondition(condition, pars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "删除失败"
 				br.ErrMsg = "获取下一级图库分类信息失败,Err:" + err.Error()
 				return
 			}
 			if classifyItem != nil {
 				nextItem, err = data_manage.GetNextChartInfo(chartInfo.ChartClassifyId)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					br.Msg = "删除失败"
 					br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
 					return
@@ -497,7 +497,7 @@ func (c *ClassifyController) ChartClassifyMove() {
 
 	} else {
 		firstClassify, err := data_manage.GetFirstChartClassifyByParentIdAndSource(chartClassifyInfo.ParentId, chartClassifyInfo.Source)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "获取跨品种分析图表分类排序第一条的分类信息失败,Err:" + err.Error()
 			return

+ 3 - 3
controllers/data_manage/cross_variety/tag.go

@@ -45,7 +45,7 @@ func (c *TagController) Add() {
 	}
 	TagName := utils.TrimStr(req.TagName)
 	item, err := cross_variety.GetTagByName(TagName)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "添加失败"
 		br.ErrMsg = "添加失败,Err:" + err.Error()
 		return
@@ -110,7 +110,7 @@ func (c *TagController) Edit() {
 	TagName := utils.TrimStr(req.TagName)
 
 	item, err := cross_variety.GetTagByName(TagName)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "添加失败"
 		br.ErrMsg = "添加失败,Err:" + err.Error()
 		return
@@ -248,7 +248,7 @@ func (c *TagController) Delete() {
 
 	varietyInfo, err := cross_variety.GetTagById(req.ChartTagId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "该标签不存在或已删除"
 			br.IsSendEmail = false
 		} else {

+ 3 - 3
controllers/data_manage/cross_variety/variety.go

@@ -44,7 +44,7 @@ func (c *VarietyController) Add() {
 	}
 	varietyName := utils.TrimStr(req.VarietyName)
 	item, err := cross_variety.GetVarietyByName(varietyName)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "添加失败"
 		br.ErrMsg = "添加失败,Err:" + err.Error()
 		return
@@ -109,7 +109,7 @@ func (c *VarietyController) Edit() {
 	varietyName := utils.TrimStr(req.VarietyName)
 
 	item, err := cross_variety.GetVarietyByName(varietyName)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "添加失败"
 		br.ErrMsg = "添加失败,Err:" + err.Error()
 		return
@@ -246,7 +246,7 @@ func (c *VarietyController) Delete() {
 
 	varietyInfo, err := cross_variety.GetVarietyById(req.ChartVarietyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "该品种不存在或已删除"
 			br.IsSendEmail = false
 		} else {

+ 2 - 2
controllers/data_manage/data_manage_permission/message.go

@@ -129,7 +129,7 @@ func (c *DataMangePermissionController) MessageRead() {
 	messageOb := new(data_manage_permission.DataPermissionMessage)
 	messageItem, e := messageOb.GetItemById(req.MessageId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "消息不存在, 请刷新页面"
 			return
 		}
@@ -221,7 +221,7 @@ func (c *DataMangePermissionController) MessageDetail() {
 	messageOb := new(data_manage_permission.DataPermissionMessage)
 	messageItem, e := messageOb.GetItemById(messageId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "消息不存在, 请刷新页面"
 			return
 		}

+ 18 - 18
controllers/data_manage/edb_classify.go

@@ -32,13 +32,13 @@ func (this *EdbClassifyController) ListV2() {
 		this.ServeJSON()
 	}()
 	rootList, err := data_manage.GetEdbClassifyByParentId(0, 0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 	classifyAll, err := data_manage.GetEdbClassifyAll()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -60,7 +60,7 @@ func (this *EdbClassifyController) ListV2() {
 	// 获取当前账号的不可见指标
 	obj := data_manage.EdbInfoNoPermissionAdmin{}
 	confList, err := obj.GetAllListByAdminId(this.SysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 		return
@@ -70,7 +70,7 @@ func (this *EdbClassifyController) ListV2() {
 		noPermissionEdbInfoIdMap[v.EdbInfoId] = true
 	}
 	allEdbInfo, err := data_manage.GetEdbInfoAll(utils.EDB_INFO_TYPE)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -653,13 +653,13 @@ func (this *EdbClassifyController) ItemsV2() {
 		this.ServeJSON()
 	}()
 	rootList, err := data_manage.GetEdbClassifyByParentId(0, 0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 	classifyAll, err := data_manage.GetEdbClassifyAll()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -778,7 +778,7 @@ func (this *EdbClassifyController) ClassifyEdbInfoList() {
 	// 获取当前账号的不可见指标
 	obj := data_manage.EdbInfoNoPermissionAdmin{}
 	confList, err := obj.GetAllListByAdminId(this.SysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 		return
@@ -789,7 +789,7 @@ func (this *EdbClassifyController) ClassifyEdbInfoList() {
 	}
 
 	allEdbInfo, err := data_manage.GetEdbInfoByClassifyId(classifyId, 0, 0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -839,19 +839,19 @@ func (this *EdbClassifyController) ItemsV3() {
 		this.ServeJSON()
 	}()
 	rootList, err := data_manage.GetEdbClassifyByParentId(0, 0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 	rootTwoList, err := data_manage.GetEdbClassifyByParentIdTwo(0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 	classifyAll, err := data_manage.GetEdbClassifyAllV2(0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -977,7 +977,7 @@ func (this *EdbClassifyController) SimpleList() {
 		sysUserId = this.SysUser.AdminId
 	}
 	rootList, err := data_manage.GetEdbClassifyByParentId(parentId, 0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -990,7 +990,7 @@ func (this *EdbClassifyController) SimpleList() {
 		// 获取当前账号的不可见指标
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -1114,7 +1114,7 @@ func (this *EdbClassifyController) ClassifyTree() {
 	}()
 	level, _ := this.GetInt(`Level`)
 	allList, err := data_manage.GetNormalEdbClassifyAll()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -1289,7 +1289,7 @@ func (this *EdbInfoController) ClassifyEdbInfoList() {
 			pars = append(pars, classifyIdsArr)
 		} else {
 			classifyAll, err := data_manage.GetNormalEdbClassifyAll()
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取数据失败,Err:" + err.Error()
 				return
@@ -1342,7 +1342,7 @@ func (this *EdbInfoController) ClassifyEdbInfoList() {
 	// 获取当前账号的不可见指标
 	obj := data_manage.EdbInfoNoPermissionAdmin{}
 	confList, err := obj.GetAllListByAdminId(this.SysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 		return
@@ -1357,7 +1357,7 @@ func (this *EdbInfoController) ClassifyEdbInfoList() {
 	}
 
 	count, err := data_manage.GetEdbInfoByConditionCount(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -1365,7 +1365,7 @@ func (this *EdbInfoController) ClassifyEdbInfoList() {
 	page := paging.GetPaging(currentIndex, pageSize, count)
 
 	list, err := data_manage.GetEdbInfoListByCondition(condition, pars, startSize, pageSize, "")
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return

文件差异内容过多而无法显示
+ 116 - 118
controllers/data_manage/edb_info.go


+ 12 - 7
controllers/data_manage/edb_info_calculate.go

@@ -764,7 +764,7 @@ func (this *ChartInfoController) CalculateBatchEdit() {
 
 	edbInfo, err := data_manage.GetEdbInfoById(req.EdbInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "指标已被删除,请刷新页面"
 			br.ErrMsg = "指标已被删除,请刷新页面:Err:" + err.Error()
 			return
@@ -933,7 +933,7 @@ func (this *ChartInfoController) CalculateBatchReset() {
 
 	edbInfo, err := data_manage.GetEdbInfoById(req.EdbInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "指标已被删除,请刷新页面"
 			br.ErrMsg = "指标已删除,请刷新页面:Err:" + err.Error()
 			return
@@ -968,7 +968,7 @@ func (this *ChartInfoController) CalculateBatchReset() {
 	//	for _, v := range fromEdbInfoList {
 	//		edbInfo, err := data_manage.GetEdbInfoById(v.FromEdbInfoId)
 	//		if err != nil {
-	//			if err.Error() == utils.ErrNoRow() {
+	//			if utils.IsErrNoRow(err) {
 	//				br.Msg = "重新计算失败"
 	//				br.Msg = "指标 " + strconv.Itoa(v.FromEdbInfoId) + " 不存在"
 	//				return
@@ -1347,7 +1347,7 @@ func (this *ChartInfoController) EditPythonEdb() {
 	//获取指标信息
 	edbInfo, err := data_manage.GetEdbInfoById(req.EdbInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "指标已被删除,请刷新页面"
 			br.ErrMsg = "指标已被删除,请刷新页面:Err:" + err.Error()
 			return
@@ -1476,7 +1476,12 @@ func (this *EdbInfoController) QueryEdbDataTable() {
 	if edbInfo.Source == utils.DATA_SOURCE_BUSINESS && utils.UseMongo {
 		templateStr = fmt.Sprintf("# 查询条件\nquery = {\"edb_code\": \"%s\"}\n# 排序\nsort = [(\"data_time\", -1)]  # -1 表示降序排列,对应 SQL 的 DESC\nprojection = {\"data_time\": 1, \"value\": 1, \"_id\": 0}  # 只选择data_time和value字段,忽略_id字段\n# 使用 find() 方法获取数据,然后使用 aggregate() 转换为列表\nraw_data = list(collection.find(query, projection).sort(sort))\n# 将结果转换为 DataFrame\nraw = pd.DataFrame(raw_data)\n# 转换data_time字段为本地时区时间\nraw['data_time'] = raw['data_time'].apply(lambda x: x.replace(tzinfo=utc_tz)).dt.tz_convert(local_tz).dt.strftime('%s')", edbInfo.EdbCode, "%Y-%m-%d")
 	} else {
-		templateStr = fmt.Sprintf("sql1 = f\"\"\"SELECT data_time,`value` FROM %s WHERE edb_code = '%s' ORDER BY data_time DESC;\"\"\"\nraw = pandas_fetch_all(sql1, db)", tableName, edbInfo.EdbCode)
+		switch utils.DbDriverName {
+		case `dm`:
+			templateStr = fmt.Sprintf("sql1 = f\"\"\"SELECT data_time,\"value\" FROM %s WHERE edb_code = '%s' ORDER BY data_time DESC;\"\"\"\nraw = pandas_fetch_all(sql1, db)", tableName, edbInfo.EdbCode)
+		default:
+			templateStr = fmt.Sprintf("sql1 = f\"\"\"SELECT data_time,`value` FROM %s WHERE edb_code = '%s' ORDER BY data_time DESC;\"\"\"\nraw = pandas_fetch_all(sql1, db)", tableName, edbInfo.EdbCode)
+		}
 	}
 	info := data_manage.TableInfoResp{
 		ColumnList:  columnList,
@@ -2252,7 +2257,7 @@ func (this *ChartInfoController) CalculateMultiChoice() {
 	}
 
 	list, err := data_manage.GetEdbInfoByIdList(edbIdArr)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取指标列表失败"
 		br.ErrMsg = "获取指标列表失败,Err:" + err.Error()
 		return
@@ -2445,7 +2450,7 @@ func (this *ChartInfoController) CalculateMultiSearch() {
 		}
 
 		list, err := data_manage.GetEdbInfoByIdList(edbIdArr)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取指标列表失败"
 			br.ErrMsg = "获取指标列表失败,Err:" + err.Error()
 			return

+ 11 - 11
controllers/data_manage/edb_info_refresh.go

@@ -97,14 +97,14 @@ func (c *EdbInfoController) RefreshClassifyList() {
 	switch source {
 	case utils.DATA_SOURCE_MYSTEEL_CHEMICAL: // 钢联
 		rootList, err := data_manage.GetBaseFromMysteelChemicalClassifyByParentId(0)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
 		}
 
 		classifyAll, err := data_manage.GetAllBaseFromMysteelChemicalClassify()
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
@@ -161,14 +161,14 @@ func (c *EdbInfoController) RefreshClassifyList() {
 			Children:     nil,
 		})
 		rootList, err := data_manage.GetBaseFromSmmClassifyByParentId(0)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
 		}
 
 		classifyAll, err := data_manage.GetAllBaseFromSmmClassify()
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
@@ -204,7 +204,7 @@ func (c *EdbInfoController) RefreshClassifyList() {
 
 	default:
 		tmpList, err := data_manage.GetAllEdbClassify()
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
@@ -313,7 +313,7 @@ func (c *EdbInfoController) RefreshEdbList() {
 	startSize = utils.StartIndex(currentIndex, pageSize)
 
 	total, list, err := data.GetList(source, subSource, classifyId, terminalCode, sysUserId, frequency, keyword, status, startSize, pageSize, sortParam, sortType)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -490,7 +490,7 @@ func (c *EdbInfoController) SaveEdbRefreshStatus() {
 	if req.IsSelectAll {
 		// 如果是列表全选
 		_, edbList, err := data.GetList(req.Source, req.SubSource, req.ClassifyId, req.TerminalCode, req.SysUserId, req.Frequency, req.Keyword, req.Status, 0, 100000, "", "")
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
@@ -538,7 +538,7 @@ func (c *EdbInfoController) SaveEdbRefreshStatus() {
 	if isStop == 1 {
 		fromEdbIdList := make([]int, 0)
 		edbList, e := data_manage.GetEdbInfoByIdList(edbIdList)
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取数据失败,Err:" + e.Error()
 			return
@@ -607,7 +607,7 @@ func (c *EdbInfoController) SaveEdbRefreshStatusSingle() {
 	// 查询指标
 	edbInfo, err := data_manage.GetEdbInfoById(req.EdbInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "指标不存在"
 			return
 		}
@@ -694,7 +694,7 @@ func (c *EdbInfoController) SaveRelationEdbRefreshStatus() {
 	if req.IsSelectAll {
 		// 如果是列表全选
 		_, edbList, err := data.GetEdbRelationList(req.Source, edbType, req.ClassifyId, req.SysUserId, req.Frequency, req.Keyword, req.Status, 0, 100000, "", "")
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
@@ -727,7 +727,7 @@ func (c *EdbInfoController) SaveRelationEdbRefreshStatus() {
 	}
 	//查询指标信息
 	edbList, e := data_manage.GetEdbInfoByIdList(edbIdList)
-	if e != nil && e.Error() != utils.ErrNoRow() {
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + e.Error()
 		return

+ 8 - 8
controllers/data_manage/edb_info_relation.go

@@ -80,7 +80,7 @@ func (c *EdbInfoRelationController) RelationEdbList() {
 	startSize = utils.StartIndex(currentIndex, pageSize)
 
 	total, list, err := data.GetEdbRelationList(source, edbType, classifyId, sysUserId, frequency, keyword, status, startSize, pageSize, sortParam, sortType)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -127,7 +127,7 @@ func (c *EdbInfoRelationController) RelationEdbListDetail() {
 	startSize = utils.StartIndex(currentIndex, pageSize)
 
 	total, relationList, err := data_manage.GetEdbInfoRelationDetailList(edbInfoId, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -164,7 +164,7 @@ func (c *EdbInfoRelationController) RelationEdbListDetail() {
 	objectNameMap := make(map[string]string)
 	if len(sandboxIds) > 0 {
 		sandboxList, err := sandbox.GetSandboxNameByIds(sandboxIds)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
@@ -182,7 +182,7 @@ func (c *EdbInfoRelationController) RelationEdbListDetail() {
 		pars := make([]interface{}, 0)
 		pars = append(pars, eventInfoIds)
 		eventList, err := matterOb.GetItemsByCondition(cond, pars, []string{}, "")
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取事件日历数据失败,Err:" + err.Error()
 			return
@@ -196,7 +196,7 @@ func (c *EdbInfoRelationController) RelationEdbListDetail() {
 	// 查询图表
 	if len(chartInfoIds) > 0 {
 		chartList, err := data_manage.GetChartInfoByIdList(chartInfoIds)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表数据失败,Err:" + err.Error()
 			return
@@ -213,7 +213,7 @@ func (c *EdbInfoRelationController) RelationEdbListDetail() {
 		pars := make([]interface{}, 0)
 		pars = append(pars, tableInfoIds)
 		tableList, err := excel.GetNoContentExcelInfoListByConditionNoPage(cond, pars)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取表格数据失败,Err:" + err.Error()
 			return
@@ -231,7 +231,7 @@ func (c *EdbInfoRelationController) RelationEdbListDetail() {
 			pars = make([]interface{}, 0)
 			pars = append(pars, parentIds)
 			parentList, err := excel.GetNoContentExcelInfoListByConditionNoPage(cond, pars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取表格数据失败,Err:" + err.Error()
 				return
@@ -254,7 +254,7 @@ func (c *EdbInfoRelationController) RelationEdbListDetail() {
 	// 查询预测指标名称
 	if len(predictEdbIds) > 0 {
 		predictList, err := data_manage.GetEdbInfoByIdList(predictEdbIds)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取预测指标信息失败,Err:" + err.Error()
 			return

+ 2 - 2
controllers/data_manage/eia_steo.go

@@ -557,7 +557,7 @@ func (c *EdbInfoController) EiaSteoNameCheck() {
 			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() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取钢联已存在信息失败,Err:" + err.Error()
 			return
@@ -815,7 +815,7 @@ func (this *EdbInfoController) EiaSteoAdd() {
 
 	tmpInfo, err := data_manage.GetBaseFromEiaSteoIndexByCode(req.EdbCode)
 	if err != nil {
-		if err.Error() != utils.ErrNoRow() {
+		if !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取失败,Err:" + err.Error()
 			return

+ 7 - 7
controllers/data_manage/excel/balance_table.go

@@ -506,7 +506,7 @@ func (c *ExcelInfoController) BalanceChartInfoAdd() {
 	adminItem, e := system.GetSysAdminById(sysUser.AdminId)
 	if e != nil {
 		br.Msg = "操作失败"
-		br.ErrMsg = "获取系统用户数据失败,Err:" + err.Error()
+		br.ErrMsg = "获取系统用户数据失败,Err:" + e.Error()
 		return
 	}
 	if utils.BusinessCode == utils.BusinessCodeSandbox && adminItem.DepartmentName == "ETA试用客户" {
@@ -713,7 +713,7 @@ func (c *ExcelInfoController) GetBalanceChartList() {
 	// 查询所有子表
 	excelInfo, err := excel.GetExcelInfoById(excelInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "表格不存在"
 			return
 		}
@@ -811,7 +811,7 @@ func (c *ExcelInfoController) DeleteBalanceChart() {
 	if req.ChartInfoId > 0 {
 		chartInfo, err := data_manage.GetChartInfoById(req.ChartInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "图表已删除,请刷新页面"
 				br.ErrMsg = "指标不存在,Err:" + err.Error()
 				return
@@ -1596,7 +1596,7 @@ func (this *ExcelInfoController) BalanceChartInfoBaseEdit() {
 	//判断指标名称是否存在
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,请刷新页面"
 			br.ErrMsg = "图表已被删除,请刷新页面"
 			return
@@ -1619,7 +1619,7 @@ func (this *ExcelInfoController) BalanceChartInfoBaseEdit() {
 		edbInfoId := v.EdbInfoId
 		edbInfo, err := excel.GetExcelChartEdbById(edbInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "图表不存在!"
 				br.ErrMsg = "图表指标不存在,ChartInfoId:" + strconv.Itoa(edbInfoId)
 				return
@@ -1654,7 +1654,7 @@ func (this *ExcelInfoController) BalanceChartInfoBaseEdit() {
 
 			edbExist, err := excel.GetBalanceChartEdbByCondition(edbCondition, edbPars)
 			if err != nil {
-				if err.Error() != utils.ErrNoRow() {
+				if !utils.IsErrNoRow(err) {
 					br.Msg = "判断英文指标名称是否存在失败"
 					br.ErrMsg = "判断英文指标名称是否存在失败,Err:" + err.Error()
 					return
@@ -1686,7 +1686,7 @@ func (this *ExcelInfoController) BalanceChartInfoBaseEdit() {
 
 		existItem, err := data_manage.GetChartInfoByCondition(condition, pars)
 		if err != nil {
-			if err.Error() != utils.ErrNoRow() {
+			if !utils.IsErrNoRow(err) {
 				br.Msg = "判断英文图表名称是否存在失败"
 				br.ErrMsg = "判断英文图表名称是否存在失败,Err:" + err.Error()
 				return

+ 9 - 9
controllers/data_manage/excel/custom_analysis.go

@@ -62,7 +62,7 @@ func (c *CustomAnalysisController) ExcelByName() {
 	// 获取数据详情
 	excelDetail, err := excelModel.GetNoContentExcelInfoByName(excelName, utils.CUSTOM_ANALYSIS_TABLE, sysUser.AdminId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Ret = 200
 			br.Success = true
 			br.Msg = "获取成功"
@@ -413,7 +413,7 @@ func (c *CustomAnalysisController) BaseExcelDetail() {
 	// 获取数据详情
 	excelDetail, err := excelModel.GetNoContentExcelInfoByUniqueCode(uniqueCode)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Ret = 200
 			br.Success = true
 			br.Msg = "获取成功"
@@ -571,7 +571,7 @@ func (c *CustomAnalysisController) ExcelDataList() {
 	// 获取数据详情
 	excelDetail, err := excelModel.GetNoContentExcelInfoByUniqueCode(uniqueCode)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Ret = 200
 			br.Success = true
 			br.Msg = "获取成功"
@@ -796,7 +796,7 @@ func (c *CustomAnalysisController) ClassifyList() {
 		classifyMap[v.ExcelClassifyId] = v
 	}
 	allExcelInfo, err := excelModel.GetNoContentExcelInfoAll(source, sysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取表格信息失败,Err:" + err.Error()
 		return
@@ -959,14 +959,14 @@ func (c *CustomAnalysisController) List() {
 	// 筛选分类
 	if !isShare && excelClassifyId > 0 {
 		_, err := excelModel.GetExcelClassifyById(excelClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取表格信息失败"
 			br.ErrMsg = "获取信息失败,GetExcelClassify,Err:" + err.Error()
 			return
 		}
 
 		childClassify, e, _ := excel2.GetChildClassifyByClassifyId(excelClassifyId, source)
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取分类信息失败, GetEdbClassify,Err:" + e.Error()
 			return
@@ -1000,7 +1000,7 @@ func (c *CustomAnalysisController) List() {
 	}
 	startSize = paging.StartIndex(currentIndex, pageSize)
 	list, err := excelModel.GetNoContentExcelListByCondition(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取表格信息失败"
 		br.ErrMsg = "获取表格信息失败,Err:" + err.Error()
@@ -1013,7 +1013,7 @@ func (c *CustomAnalysisController) List() {
 
 	// 总数据量
 	dataCount, err := excelModel.GetExcelListCountByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取表格列表信息失败"
 		br.ErrMsg = "获取表格列表数据总数失败,Err:" + err.Error()
 		return
@@ -1066,7 +1066,7 @@ func (c *CustomAnalysisController) Share() {
 
 	excelInfo, e := excelModel.GetExcelInfoById(req.ExcelInfoId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "表格不存在, 请刷新页面"
 			return
 		}

+ 1 - 1
controllers/data_manage/excel/custom_analysis_edb.go

@@ -312,7 +312,7 @@ func (c *CustomAnalysisController) EditEdb() {
 
 	edbInfo, err := data_manage.GetEdbInfoById(req.EdbInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "指标已被删除,请刷新页面"
 			br.ErrMsg = "指标已被删除,请刷新页面:Err:" + err.Error()
 			return

+ 15 - 15
controllers/data_manage/excel/excel_classify.go

@@ -87,14 +87,14 @@ func (this *ExcelClassifyController) List() {
 		}
 
 		allExcelInfo, err = excel.GetBalanceNoContentExcelInfoAll(source, excelIds, showUserId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取表格信息失败,Err:" + err.Error()
 			return
 		}
 	} else {
 		allExcelInfo, err = excel.GetNoContentExcelInfoAll(source, showUserId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取表格信息失败,Err:" + err.Error()
 			return
@@ -196,7 +196,7 @@ func AnalysisClassifyList(this *ExcelClassifyController) (br *models.BaseRespons
 	// 获取三级分类
 	// 根据来源获取所有excel表格(无内容)
 	allExcelInfo, err := excel.GetNoContentExcelInfoAll(source, showUserId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取表格信息失败,Err:" + err.Error()
 		return
@@ -432,7 +432,7 @@ func (this *ExcelClassifyController) AddExcelClassify() {
 		var parent *excel.ExcelClassify
 		parent, err = excel.GetExcelClassifyById(req.ParentId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "父级分类不存在"
 				return
 			}
@@ -577,7 +577,7 @@ func (this *ExcelClassifyController) DeleteExcelClassifyCheck() {
 	// 校验是否存在该分类
 	ExcelClassifyInfo, err := excel.GetExcelClassifyById(req.ExcelClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "该分类不存在"
 			br.ErrMsg = "该分类不存在"
 			return
@@ -607,7 +607,7 @@ func (this *ExcelClassifyController) DeleteExcelClassifyCheck() {
 			tipsMsg = "该分类下关联表格不可删除"
 		} else {
 			childClassify, e := excel.GetChildClassifyById(req.ExcelClassifyId)
-			if e != nil && e.Error() != utils.ErrNoRow() {
+			if e != nil && !utils.IsErrNoRow(e) {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取分类信息失败, GetEdbClassify,Err:" + e.Error()
 				return
@@ -621,7 +621,7 @@ func (this *ExcelClassifyController) DeleteExcelClassifyCheck() {
 				var pars []interface{}
 				pars = append(pars, classifyIds)
 				childCount, err := excel.GetExcelInfoCountByCondition(condition, pars)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					br.Msg = "删除失败"
 					br.ErrMsg = "查询分类下表格数量失败,Err:" + err.Error()
 					return
@@ -701,7 +701,7 @@ func (this *ExcelClassifyController) DeleteExcelClassify() {
 	if req.ExcelClassifyId > 0 && req.ExcelInfoId == 0 {
 		//判断是否含有指标
 		count, err := excel.GetExcelInfoCountByClassifyId(req.ExcelClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
 			return
@@ -713,7 +713,7 @@ func (this *ExcelClassifyController) DeleteExcelClassify() {
 			return
 		} else {
 			childClassify, e := excel.GetChildClassifyById(req.ExcelClassifyId)
-			if e != nil && e.Error() != utils.ErrNoRow() {
+			if e != nil && !utils.IsErrNoRow(e) {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取分类信息失败, GetEdbClassify,Err:" + e.Error()
 				return
@@ -727,7 +727,7 @@ func (this *ExcelClassifyController) DeleteExcelClassify() {
 				var pars []interface{}
 				pars = append(pars, classifyIds)
 				childCount, err := excel.GetExcelInfoCountByCondition(condition, pars)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					br.Msg = "删除失败"
 					br.ErrMsg = "查询分类下表格数量失败,Err:" + err.Error()
 					return
@@ -744,7 +744,7 @@ func (this *ExcelClassifyController) DeleteExcelClassify() {
 		if err != nil {
 			br.Msg = "删除失败"
 			br.ErrMsg = "获取分类失败,Err:" + err.Error()
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "分类不存在"
 				br.ErrMsg = "分类不存在"
 			}
@@ -764,7 +764,7 @@ func (this *ExcelClassifyController) DeleteExcelClassify() {
 	if req.ExcelInfoId > 0 {
 		excelInfo, err := excel.GetExcelInfoById(req.ExcelInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "表格已删除,请刷新页面"
 				br.ErrMsg = "表格已删除,请刷新页面"
 				return
@@ -808,7 +808,7 @@ func (this *ExcelClassifyController) DeleteExcelClassify() {
 			pars = append(pars, excelInfo.Sort, excelInfo.Sort, excelInfo.ExcelInfoId)
 
 			nextItem, err = excel.GetNextExcelInfoByCondition(condition, pars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "删除失败"
 				br.ErrMsg = "获取下一级表格信息失败,Err:" + err.Error()
 				return
@@ -817,14 +817,14 @@ func (this *ExcelClassifyController) DeleteExcelClassify() {
 			// 如果没找到,那么查找下一个分类的第一个表格
 			if nextItem == nil {
 				currClassifyInfo, err := excel.GetExcelClassifyById(excelInfo.ExcelClassifyId)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					br.Msg = "删除失败"
 					br.ErrMsg = "获取当前表格分类信息失败,Err:" + err.Error()
 					return
 				}
 
 				nextItem, err = excel.GetNextExcelInfo(excelInfo.ExcelClassifyId, currClassifyInfo.Sort, currClassifyInfo.Source)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					br.Msg = "删除失败"
 					br.ErrMsg = "获取下一级表格信息失败,Err:" + err.Error()
 					return

+ 47 - 21
controllers/data_manage/excel/excel_info.go

@@ -91,7 +91,7 @@ func (c *ExcelInfoController) Add() {
 	if req.ExcelClassifyId > 0 {
 		excelClassify, e := excel3.GetExcelClassifyById(req.ExcelClassifyId)
 		if e != nil {
-			if e.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(e) {
 				br.Msg = "分类不存在"
 				br.ErrMsg = "分类不存在"
 				br.IsSendEmail = false
@@ -112,7 +112,7 @@ func (c *ExcelInfoController) Add() {
 	if req.ParentId > 0 {
 		parentExcelInfo, e := excel3.GetExcelInfoById(req.ParentId)
 		if e != nil {
-			if e.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(e) {
 				br.Msg = "父级ETA表格被删除,请刷新页面"
 				return
 			}
@@ -123,6 +123,18 @@ func (c *ExcelInfoController) Add() {
 		req.ExcelClassifyId = parentExcelInfo.ExcelClassifyId
 	}
 
+	// 额外配置(表格冻结行列等)
+	var extraConfig string
+	if req.ExtraConfig != nil {
+		b, e := json.Marshal(req.ExtraConfig)
+		if e != nil {
+			br.Msg = "操作失败"
+			br.ErrMsg = fmt.Sprintf("操作失败, %v", e)
+			return
+		}
+		extraConfig = string(b)
+	}
+
 	var condition string
 	var pars []interface{}
 	condition += " AND excel_classify_id=? AND parent_id=?"
@@ -259,6 +271,7 @@ func (c *ExcelInfoController) Add() {
 		UpdateUserId:       sysUser.AdminId,
 		UpdateUserRealName: sysUser.RealName,
 		SourcesFrom:        req.SourcesFrom,
+		ExtraConfig:        extraConfig,
 	}
 
 	excelEdbMappingList := make([]*excel3.ExcelEdbMapping, 0)
@@ -295,6 +308,7 @@ func (c *ExcelInfoController) Add() {
 			//ParentId:           req.ParentId,
 			UpdateUserId:       sysUser.AdminId,
 			UpdateUserRealName: sysUser.RealName,
+			ExtraConfig:        extraConfig,
 		}
 	}
 	err = excel3.AddExcelInfo(excelInfo, excelEdbMappingList, childExcel)
@@ -422,14 +436,14 @@ func (c *ExcelInfoController) List() {
 	// 筛选分类
 	if excelClassifyId > 0 {
 		_, err := excel3.GetExcelClassifyById(excelClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取表格信息失败"
 			br.ErrMsg = "获取信息失败,GetExcelClassify,Err:" + err.Error()
 			return
 		}
 
 		childClassify, e, _ := excel2.GetChildClassifyByClassifyId(excelClassifyId, source)
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取分类信息失败, GetEdbClassify,Err:" + e.Error()
 			return
@@ -507,7 +521,7 @@ func (c *ExcelInfoController) List() {
 
 			//获取表格信息
 			tmpList, e := excel3.GetNoContentExcelListByConditionNoPage(newCondition, newPars)
-			if e != nil && e.Error() != utils.ErrNoRow() {
+			if e != nil && !utils.IsErrNoRow(e) {
 				br.Success = true
 				br.Msg = "获取表格信息失败"
 				br.ErrMsg = "获取表格信息失败,Err:" + e.Error()
@@ -565,7 +579,7 @@ func (c *ExcelInfoController) List() {
 	}
 	//获取表格信息
 	list, err := excel3.GetNoContentExcelListByCondition(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取表格信息失败"
 		br.ErrMsg = "获取表格信息失败,Err:" + err.Error()
@@ -573,7 +587,7 @@ func (c *ExcelInfoController) List() {
 	}
 
 	lenList := len(list)
-	if list == nil || lenList <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || lenList <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		list = make([]*excel3.MyExcelInfoList, 0)
 	}
 
@@ -634,7 +648,7 @@ func (c *ExcelInfoController) List() {
 
 	// 总数据量
 	dataCount, err := excel3.GetExcelListCountByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取表格列表信息失败"
 		br.ErrMsg = "获取表格列表数据总数失败,Err:" + err.Error()
 		return
@@ -885,7 +899,7 @@ func (c *ExcelInfoController) Edit() {
 	if req.ExcelClassifyId > 0 {
 		excelClassify, e := excel3.GetExcelClassifyById(req.ExcelClassifyId)
 		if e != nil {
-			if e.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(e) {
 				br.Msg = "分类不存在"
 				br.ErrMsg = "分类不存在"
 				br.IsSendEmail = false
@@ -905,7 +919,7 @@ func (c *ExcelInfoController) Edit() {
 	if excelInfo.ParentId > 0 {
 		parentExcelInfo, e := excel3.GetExcelInfoById(excelInfo.ParentId)
 		if e != nil {
-			if e.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(e) {
 				br.Msg = "父级ETA表格被删除,请刷新页面"
 				return
 			}
@@ -1057,6 +1071,18 @@ func (c *ExcelInfoController) Edit() {
 		updateExcelInfoParams = []string{"ModifyTime", "ExcelName", "ExcelType", "ExcelClassifyId", "Content", "SourcesFrom"}
 	}
 
+	// 额外配置(表格冻结行列等)
+	if req.ExtraConfig != nil {
+		b, e := json.Marshal(req.ExtraConfig)
+		if e != nil {
+			br.Msg = "操作失败"
+			br.ErrMsg = fmt.Sprintf("操作失败, %v", e)
+			return
+		}
+		excelInfo.ExtraConfig = string(b)
+		updateExcelInfoParams = append(updateExcelInfoParams, "ExtraConfig")
+	}
+
 	excelEdbMappingList := make([]*excel3.ExcelEdbMapping, 0)
 	if len(edbInfoIdList) > 0 {
 		for _, edbInfoId := range edbInfoIdList {
@@ -1185,7 +1211,7 @@ func (c *ExcelInfoController) Move() {
 			br.Msg = "移动失败"
 			br.ErrMsg = "获取分类信息失败" + err.Error()
 
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "分类已被删除,不可移动,请刷新页面"
 				br.ErrMsg = "分类已被删除,不可移动,请刷新页面"
 				br.IsSendEmail = false
@@ -1394,7 +1420,7 @@ func (c *ExcelInfoController) Delete() {
 		condition += " AND sort>=? "
 		pars = append(pars, excelInfo.Sort)
 		nextItem, err = excel3.GetNextExcelInfoByCondition(condition, pars)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "获取下一级表格信息失败,Err:" + err.Error()
 			return
@@ -1403,7 +1429,7 @@ func (c *ExcelInfoController) Delete() {
 		// 如果没找到,那么查找下一个分类的第一个表格
 		if nextItem == nil {
 			currClassifyInfo, err := excel3.GetExcelClassifyById(excelInfo.ExcelClassifyId)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "删除失败"
 				br.ErrMsg = "获取当前表格分类信息失败,Err:" + err.Error()
 				return
@@ -1432,7 +1458,7 @@ func (c *ExcelInfoController) Delete() {
 			//}
 
 			nextItem, err = excel3.GetNextExcelInfo(excelInfo.ExcelClassifyId, currClassifyInfo.Sort, currClassifyInfo.Source)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "删除失败"
 				br.ErrMsg = "获取下一级表格信息失败,Err:" + err.Error()
 				return
@@ -1507,7 +1533,7 @@ func (c *ExcelInfoController) AddDraft() {
 
 	excelClassify, err := excel3.GetExcelClassifyById(req.ExcelClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在"
 			br.ErrMsg = "分类不存在"
 			br.IsSendEmail = false
@@ -1606,7 +1632,7 @@ func (c *ExcelInfoController) GetExcelTableData() {
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取ETA表格信息失败,Err:" + err.Error()
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "ETA表格被删除,请刷新页面"
 			br.ErrMsg = "ETA表格被删除,请刷新页面,Err:" + err.Error()
 			br.IsSendEmail = false
@@ -1726,7 +1752,7 @@ func (c *ExcelInfoController) GetExcelTableData() {
 
 	// 获取表格引用
 	reference, err := excel3.GetReferencedExcelConfig(referencedId, fromScene, uniqueCode, uuid)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取表格引用失败,Err:" + err.Error()
 		return
@@ -2638,7 +2664,7 @@ func (c *ExcelInfoController) Download() {
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取ETA表格信息失败,Err:" + err.Error()
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "ETA表格被删除,请刷新页面"
 			br.ErrMsg = "ETA表格被删除,请刷新页面,Err:" + err.Error()
 			br.IsSendEmail = false
@@ -3072,7 +3098,7 @@ func (c *ExcelInfoController) BatchRefresh() {
 	syncing, e := data.BatchRefreshEdbByEdbIds(edbIds, redisKey, refreshKeys)
 	if e != nil {
 		br.Msg = "刷新失败"
-		br.ErrMsg = "刷新表格关联指标信息失败,Err:" + err.Error()
+		br.ErrMsg = "刷新表格关联指标信息失败,Err:" + e.Error()
 		return
 	}
 
@@ -3708,7 +3734,7 @@ func (c *ExcelInfoController) SaveExcelReference() {
 	addList := make([]*excel3.ReferencedExcelConfig, 0)
 
 	exist, e := excel3.GetReferencedExcelConfig(req.ReferencedId, req.FromScene, req.UniqueCode, req.Uuid)
-	if e != nil && e.Error() != utils.ErrNoRow() {
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "查找引用失败"
 		br.ErrMsg = "查找引用失败,Err:" + e.Error()
 		return
@@ -3743,7 +3769,7 @@ func (c *ExcelInfoController) SaveExcelReference() {
 
 	if len(addList) > 0 {
 		err = excel3.AddReferencedExcelConfig(addList)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "添加引用失败"
 			br.ErrMsg = "添加引用失败,Err:" + err.Error()
 			return

+ 2 - 2
controllers/data_manage/factor_edb_series.go

@@ -328,7 +328,7 @@ func (this *FactorEdbSeriesController) Edit() {
 	seriesOb := new(data_manage.FactorEdbSeries)
 	seriesItem, e := seriesOb.GetItemById(req.SeriesId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "该因子指标系列不存在"
 			return
 		}
@@ -460,7 +460,7 @@ func (this *FactorEdbSeriesController) Detail() {
 	seriesOb := new(data_manage.FactorEdbSeries)
 	series, e := seriesOb.GetItemById(seriesId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "该因子指标系列不存在"
 			return
 		}

+ 1 - 1
controllers/data_manage/fenwei_data.go

@@ -944,7 +944,7 @@ func (this *EdbInfoController) FenWeiIndexDataExport() {
 
 			var dataList []*data_manage.BaseFromFenweiData
 			dataList, err = data_manage.GetBaseFromFenWeiDataByIndexCode(v.IndexCode)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.ErrMsg = "GetBaseFromFenWeiDataByIndexCode,Err:" + err.Error()
 				br.Msg = "获取数据失败"
 				return

+ 15 - 0
controllers/data_manage/fix.go

@@ -0,0 +1,15 @@
+package data_manage
+
+func init() {
+
+	// 刷新指标
+	//data.AddOrEditAllEdbInfoToEs()
+
+	// 修复ETA图库
+	//data.AddAllChartInfo()
+
+	// 修复我的图库
+	//data.AddAllMyChartInfo()
+	//
+	//fmt.Println("修复完成")
+}

+ 12 - 12
controllers/data_manage/future_good/future_good_chart_classify.go

@@ -36,7 +36,7 @@ func (this *FutureGoodChartClassifyController) ChartClassifyList() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -67,14 +67,14 @@ func (this *FutureGoodChartClassifyController) ChartClassifyList() {
 	}
 
 	rootList, err := data_manage.GetChartClassifyByParentId(0, utils.CHART_SOURCE_FUTURE_GOOD)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	allChartInfo, err := data_manage.GetChartInfoAll([]int{utils.CHART_SOURCE_FUTURE_GOOD, utils.CHART_SOURCE_FUTURE_GOOD_PROFIT})
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 		return
@@ -108,13 +108,13 @@ func (this *FutureGoodChartClassifyController) ChartClassifyList() {
 // getChartClassifyListForMe 获取我创建的图表
 func getChartClassifyListForMe(adminInfo system.Admin, resp *data_manage.ChartClassifyListResp) (errMsg string, err error) {
 	rootList, err := data_manage.GetChartClassifyByParentId(0, utils.CHART_SOURCE_FUTURE_GOOD)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
 
 	allChartInfo, err := data_manage.GetChartInfoByAdminId([]int{utils.CHART_SOURCE_FUTURE_GOOD, utils.CHART_SOURCE_FUTURE_GOOD_PROFIT}, adminInfo.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
@@ -307,7 +307,7 @@ func (this *FutureGoodChartClassifyController) DeleteChartClassifyCheck() {
 
 	if deleteStatus != 1 && req.ChartInfoId == 0 {
 		classifyCount, err := data_manage.GetChartClassifyCountByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "分类下是否含有图表失败,Err:" + err.Error()
 			return
@@ -369,7 +369,7 @@ func (this *FutureGoodChartClassifyController) DeleteChartClassify() {
 	if req.ChartClassifyId > 0 && req.ChartInfoId == 0 {
 		//判断是否含有指标
 		count, err := data_manage.GetChartInfoCountByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
 			return
@@ -393,7 +393,7 @@ func (this *FutureGoodChartClassifyController) DeleteChartClassify() {
 	if req.ChartInfoId > 0 {
 		chartInfo, err := data_manage.GetChartInfoById(req.ChartInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "图表已删除,请刷新页面"
 				br.ErrMsg = "指标不存在,Err:" + err.Error()
 				return
@@ -455,7 +455,7 @@ func (this *FutureGoodChartClassifyController) DeleteChartClassify() {
 		pars = append(pars, req.ChartInfoId)
 
 		nextItem, err := data_manage.GetChartInfoByCondition(condition, pars)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
 			return
@@ -475,14 +475,14 @@ func (this *FutureGoodChartClassifyController) DeleteChartClassify() {
 			pars = append(pars, chartInfo.ChartClassifyId)
 
 			classifyItem, err := data_manage.GetChartClassifyByCondition(condition, pars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "删除失败"
 				br.ErrMsg = "获取下一级图库分类信息失败,Err:" + err.Error()
 				return
 			}
 			if classifyItem != nil {
 				nextItem, err = data_manage.GetNextChartInfo(chartInfo.ChartClassifyId)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					br.Msg = "删除失败"
 					br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
 					return
@@ -617,7 +617,7 @@ func (this *FutureGoodChartClassifyController) ChartClassifyMove() {
 
 	} else {
 		firstClassify, err := data_manage.GetFirstChartClassifyByParentId(chartClassifyInfo.ParentId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "获取获取当前父级分类下的排序第一条的分类信息失败,Err:" + err.Error()
 			return

+ 38 - 38
controllers/data_manage/future_good/future_good_chart_info.go

@@ -82,7 +82,7 @@ func (this *FutureGoodChartInfoController) ChartList() {
 
 	if chartClassifyId > 0 {
 		chartClassifyId, err := data_manage.GetChartClassify(chartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取图表信息失败"
 			br.ErrMsg = "获取信息失败,GetChartClassify,Err:" + err.Error()
 			return
@@ -123,7 +123,7 @@ func (this *FutureGoodChartInfoController) ChartList() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -141,7 +141,7 @@ func (this *FutureGoodChartInfoController) ChartList() {
 
 	//获取图表信息
 	list, err := data_manage.GetChartListByCondition(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
@@ -149,7 +149,7 @@ func (this *FutureGoodChartInfoController) ChartList() {
 	}
 
 	myChartList, err := data_manage.GetMyChartListByAdminId(sysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取我的图表信息失败,Err:" + err.Error()
 		return
@@ -193,7 +193,7 @@ func (this *FutureGoodChartInfoController) ChartList() {
 	}
 
 	resp := new(data_manage.ChartListResp)
-	if list == nil || len(list) <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || len(list) <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		items := make([]*data_manage.ChartInfoView, 0)
 		resp.Paging = page
 		resp.List = items
@@ -204,7 +204,7 @@ func (this *FutureGoodChartInfoController) ChartList() {
 	}
 
 	dataCount, err := data_manage.GetChartListCountByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取指标信息失败"
 		br.ErrMsg = "获取指标数据总数失败,Err:" + err.Error()
 		return
@@ -254,7 +254,7 @@ func (this *FutureGoodChartInfoController) ChartInfoSave() {
 
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,请刷新页面!"
 			br.ErrMsg = "图表已被删除,请刷新页面,ChartInfoId:" + strconv.Itoa(req.ChartInfoId)
 			return
@@ -363,7 +363,7 @@ func (this *FutureGoodChartInfoController) ChartInfoAdd() {
 
 	chartClassify, err := data_manage.GetChartClassifyById(req.ChartClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在"
 			br.ErrMsg = "分类不存在"
 			return
@@ -405,7 +405,7 @@ func (this *FutureGoodChartInfoController) ChartInfoAdd() {
 		if v.Source == utils.CHART_SOURCE_DEFAULT { //ETA指标
 			edbInfo, err := data_manage.GetEdbInfoById(edbInfoId)
 			if err != nil {
-				if err.Error() == utils.ErrNoRow() {
+				if utils.IsErrNoRow(err) {
 					br.Msg = "指标不存在!"
 					br.ErrMsg = "指标不存在,edbInfoId:" + strconv.Itoa(edbInfoId)
 					return
@@ -433,7 +433,7 @@ func (this *FutureGoodChartInfoController) ChartInfoAdd() {
 		} else { // 商品指标
 			edbInfo, err := future_good.GetFutureGoodEdbInfo(edbInfoId)
 			if err != nil {
-				if err.Error() == utils.ErrNoRow() {
+				if utils.IsErrNoRow(err) {
 					br.Msg = "指标不存在!"
 					br.ErrMsg = "指标不存在,edbInfoId:" + strconv.Itoa(edbInfoId)
 					return
@@ -648,7 +648,7 @@ func (this *FutureGoodChartInfoController) ChartInfoEdit() {
 
 	chartClassify, err := data_manage.GetChartClassifyById(req.ChartClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在"
 			br.ErrMsg = "分类不存在"
 			return
@@ -664,7 +664,7 @@ func (this *FutureGoodChartInfoController) ChartInfoEdit() {
 	}
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,请刷新页面"
 			br.ErrMsg = "图表已被删除,请刷新页面"
 			return
@@ -726,7 +726,7 @@ func (this *FutureGoodChartInfoController) ChartInfoEdit() {
 		if v.Source == utils.CHART_SOURCE_DEFAULT { //ETA指标
 			edbInfo, err := data_manage.GetEdbInfoById(edbInfoId)
 			if err != nil {
-				if err.Error() == utils.ErrNoRow() {
+				if utils.IsErrNoRow(err) {
 					br.Msg = "图表不存在!"
 					br.ErrMsg = "图表指标不存在,ChartInfoId:" + strconv.Itoa(edbInfoId)
 					return
@@ -746,7 +746,7 @@ func (this *FutureGoodChartInfoController) ChartInfoEdit() {
 		} else { //商品指标
 			edbInfo, err := future_good.GetFutureGoodEdbInfo(edbInfoId)
 			if err != nil {
-				if err.Error() == utils.ErrNoRow() {
+				if utils.IsErrNoRow(err) {
 					br.Msg = "指标不存在!"
 					br.ErrMsg = "指标不存在,edbInfoId:" + strconv.Itoa(edbInfoId)
 					return
@@ -862,7 +862,7 @@ func (this *FutureGoodChartInfoController) ChartEnInfoEdit() {
 
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,请刷新页面"
 			br.ErrMsg = "图表已被删除,请刷新页面"
 			return
@@ -896,7 +896,7 @@ func (this *FutureGoodChartInfoController) ChartEnInfoEdit() {
 	//校验指标信息是否存在
 	edbInfo, err := data_manage.GetEdbInfoById(edbInfoMapping.EdbInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表不存在!"
 			br.ErrMsg = "图表指标不存在,ChartInfoId:" + strconv.Itoa(edbInfoMapping.EdbInfoId)
 			return
@@ -926,7 +926,7 @@ func (this *FutureGoodChartInfoController) ChartEnInfoEdit() {
 
 		existItem, err := data_manage.GetChartInfoByCondition(condition, pars)
 		if err != nil {
-			if err.Error() != utils.ErrNoRow() {
+			if !utils.IsErrNoRow(err) {
 				br.Msg = "判断英文图表名称是否存在失败"
 				br.ErrMsg = "判断英文图表名称是否存在失败,Err:" + err.Error()
 				return
@@ -951,7 +951,7 @@ func (this *FutureGoodChartInfoController) ChartEnInfoEdit() {
 			}
 			futureGoodEdbInfo, err := future_good.GetFutureGoodEdbInfo(futureGoodEdbInfoMapping.EdbInfoId)
 			if err != nil {
-				if err.Error() == utils.ErrNoRow() {
+				if utils.IsErrNoRow(err) {
 					br.Msg = "图表不存在!"
 					br.ErrMsg = "图表指标不存在,ChartInfoId:" + strconv.Itoa(edbInfoMapping.EdbInfoId)
 					return
@@ -1040,7 +1040,7 @@ func (this *FutureGoodChartInfoController) ChartInfoNewest() {
 		this.ServeJSON()
 	}()
 	item, err := data_manage.GetChartInfoByNewest(2)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取最新图表失败"
 		br.ErrMsg = "获取最新图表失败,Err:" + err.Error()
 		return
@@ -1113,12 +1113,12 @@ func (this *FutureGoodChartInfoController) ChartInfoMove() {
 	if chartInfo.ChartClassifyId != req.ChartClassifyId {
 		//查询需要修改的分类下是否存在同一个图表名称
 		tmpChartInfo, tmpErr := data_manage.GetChartInfoByClassifyIdAndName(req.ChartClassifyId, chartInfo.ChartName)
-		if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
+		if tmpErr != nil && !utils.IsErrNoRow(tmpErr) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "移动失败,Err:" + tmpErr.Error()
 			return
 		}
-		if tmpChartInfo != nil {
+		if tmpChartInfo != nil && tmpChartInfo.ChartInfoId > 0 {
 			br.Msg = "移动失败,同一个分类下图表名称不允许重复"
 			br.ErrMsg = "移动失败,同一个分类下图表名称不允许重复"
 			return
@@ -1172,7 +1172,7 @@ func (this *FutureGoodChartInfoController) ChartInfoMove() {
 
 	} else {
 		firstClassify, err := data_manage.GetFirstChartInfoByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "获取获取当前父级分类下的排序第一条的分类信息失败,Err:" + err.Error()
 			return
@@ -1284,7 +1284,7 @@ func (this *FutureGoodChartInfoController) ChartInfoDetail() {
 	if chartInfoId > 0 {
 		chartInfo, err = data_manage.GetChartInfoViewById(chartInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "图被删除,请刷新页面"
 				br.ErrMsg = "图被删除,请刷新页面,Err:" + err.Error()
 				return
@@ -1328,7 +1328,7 @@ func getFutureGoodChartInfo(chartInfo *data_manage.ChartInfoView, chartType, dat
 	}
 	futureGoodEdbInfoMapping, err = data_manage.GetFutureGoodEdbChartEdbMapping(chartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "期货指标不存在"
 			return
 		}
@@ -1462,7 +1462,7 @@ func getFutureGoodChartInfo(chartInfo *data_manage.ChartInfoView, chartType, dat
 			myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 			myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 				return
@@ -1535,7 +1535,7 @@ func (this *FutureGoodChartInfoController) ChartInfoDetailFromUniqueCode() {
 	status := true
 	chartInfo, err := data_manage.GetChartInfoViewByUniqueCode(uniqueCode)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			status = false
 		} else {
 			br.Msg = "获取失败"
@@ -1589,7 +1589,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 				myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 				myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					msg = "获取失败"
 					errMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 					return
@@ -1831,7 +1831,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 			myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 			myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				msg = "获取失败"
 				errMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 				return
@@ -2173,7 +2173,7 @@ func (this *FutureGoodChartInfoController) BaseChartInfoDetailFromUniqueCode() {
 	status := true
 	chartInfo, err := data_manage.GetChartInfoViewByUniqueCode(uniqueCode)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			status = false
 		} else {
 			br.Msg = "获取失败"
@@ -2304,7 +2304,7 @@ func (this *FutureGoodChartInfoController) BaseChartInfoDetailFromUniqueCode() {
 			myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 			myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 				return
@@ -2400,7 +2400,7 @@ func (this *FutureGoodChartInfoController) ChartInfoSearchByEs() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -2414,7 +2414,7 @@ func (this *FutureGoodChartInfoController) ChartInfoSearchByEs() {
 		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, []int{utils.CHART_SOURCE_FUTURE_GOOD, utils.CHART_SOURCE_FUTURE_GOOD_PROFIT}, noPermissionChartIdList, startSize, pageSize)
 	} else {
 		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, []int{utils.CHART_SOURCE_FUTURE_GOOD, utils.CHART_SOURCE_FUTURE_GOOD_PROFIT}, noPermissionChartIdList, startSize, pageSize)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 			return
@@ -2513,7 +2513,7 @@ func (this *FutureGoodChartInfoController) ChartInfoRefresh() {
 		chartInfo, err = data_manage.GetChartInfoByUniqueCode(uniqueCode)
 	}
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,无需刷新"
 			br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 			return
@@ -2893,7 +2893,7 @@ func copyChartInfo(oldChartInfo *data_manage.ChartInfo, chartClassifyId int, cha
 	}
 	chartClassify, err := data_manage.GetChartClassifyById(chartClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在"
 			br.ErrMsg = "分类不存在"
 			return
@@ -3218,7 +3218,7 @@ func (this *FutureGoodChartInfoController) BaseInfoEdit() {
 
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,请刷新页面"
 			br.ErrMsg = "图表已被删除,请刷新页面"
 			return
@@ -3255,7 +3255,7 @@ func (this *FutureGoodChartInfoController) BaseInfoEdit() {
 	//校验指标信息是否存在
 	edbInfoList, err := data_manage.GetEdbInfoByIdList(edbIds)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表不存在!"
 			br.ErrMsg = "图表指标不存在,ChartInfoId:" + strconv.Itoa(req.ChartInfoId)
 			return
@@ -3298,7 +3298,7 @@ func (this *FutureGoodChartInfoController) BaseInfoEdit() {
 
 			edbExist, e := data_manage.GetEdbInfoByCondition(edbCondition, edbPars)
 			if e != nil {
-				if e.Error() != utils.ErrNoRow() {
+				if !utils.IsErrNoRow(e) {
 					br.Msg = "判断英文指标名称是否存在失败"
 					br.ErrMsg = "判断英文指标名称是否存在失败,Err:" + e.Error()
 					return
@@ -3330,7 +3330,7 @@ func (this *FutureGoodChartInfoController) BaseInfoEdit() {
 
 		existItem, err := data_manage.GetChartInfoByCondition(condition, pars)
 		if err != nil {
-			if err.Error() != utils.ErrNoRow() {
+			if !utils.IsErrNoRow(err) {
 				br.Msg = "判断英文图表名称是否存在失败"
 				br.ErrMsg = "判断英文图表名称是否存在失败,Err:" + err.Error()
 				return

+ 6 - 6
controllers/data_manage/future_good/future_good_edb_info.go

@@ -60,7 +60,7 @@ func (this *FutureGoodEdbInfoController) FutureGoodEdbInfoList() {
 	}
 
 	list, err := future_good2.GetFutureGoodEdbInfoList(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -141,14 +141,14 @@ func (this *FutureGoodEdbInfoController) FutureGoodEdbInfoDataList() {
 	}
 
 	total, err := future_good2.GetFutureGoodEdbDataListCount(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	list, err := future_good2.GetFutureGoodEdbDataList(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -156,7 +156,7 @@ func (this *FutureGoodEdbInfoController) FutureGoodEdbInfoDataList() {
 
 	// 获取用到的指标信息
 	futureGoodEdbInfoList, err := future_good2.GetAllFutureGoodEdbInfoList()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -219,7 +219,7 @@ func (this *FutureGoodEdbInfoController) FutureGoodEdbInfoGroupList() {
 	}
 
 	list, err := future_good2.GetFutureGoodEdbInfoGroupList(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -320,7 +320,7 @@ func (this *FutureGoodEdbInfoController) FutureGoodEdbExchangeList() {
 	}
 
 	list, err := future_good2.GetFutureGoodEdbExchangeList(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return

+ 9 - 9
controllers/data_manage/future_good/future_good_profit_chart_info.go

@@ -73,7 +73,7 @@ func (this *FutureGoodChartInfoController) ProfitChartInfoAdd() {
 
 	chartClassify, err := data_manage.GetChartClassifyById(req.ChartClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在"
 			br.ErrMsg = "分类不存在"
 			return
@@ -165,7 +165,7 @@ func (this *FutureGoodChartInfoController) ProfitChartInfoAdd() {
 		edbInfoId := v.EdbInfoId
 		futureGoodEdbInfo, tmpErr := future_good.GetFutureGoodEdbInfo(edbInfoId)
 		if tmpErr != nil {
-			if tmpErr.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(tmpErr) {
 				br.Msg = "期货商品指标不存在!"
 				br.ErrMsg = "期货商品指标不存在,指标id:" + strconv.Itoa(edbInfoId)
 				return
@@ -397,7 +397,7 @@ func (this *FutureGoodChartInfoController) ProfitChartInfoEdit() {
 
 	chartClassify, err := data_manage.GetChartClassifyById(req.ChartClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在"
 			br.ErrMsg = "分类不存在"
 			return
@@ -413,7 +413,7 @@ func (this *FutureGoodChartInfoController) ProfitChartInfoEdit() {
 	}
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,请刷新页面"
 			br.ErrMsg = "图表已被删除,请刷新页面"
 			return
@@ -520,7 +520,7 @@ func (this *FutureGoodChartInfoController) ProfitChartInfoEdit() {
 		edbInfoId := v.EdbInfoId
 		futureGoodEdbInfo, tmpErr := future_good.GetFutureGoodEdbInfo(edbInfoId)
 		if tmpErr != nil {
-			if tmpErr.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(tmpErr) {
 				br.Msg = "期货商品指标不存在!"
 				br.ErrMsg = "期货商品指标不存在,指标id:" + strconv.Itoa(edbInfoId)
 				return
@@ -713,7 +713,7 @@ func copyProfitChartInfo(oldChartInfo *data_manage.ChartInfo, chartClassifyId in
 	}
 	chartClassify, err := data_manage.GetChartClassifyById(chartClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在"
 			br.ErrMsg = "分类不存在"
 			return
@@ -1124,7 +1124,7 @@ func getFutureGoodProfitChartInfo(chartInfo *data_manage.ChartInfoView, sysUser
 			myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 			myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 				return
@@ -1188,7 +1188,7 @@ func GetFutureGoodProfitChartInfoDetailFromUniqueCode(chartInfo *data_manage.Cha
 				myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 				myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					msg = "获取失败"
 					errMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 					return
@@ -1387,7 +1387,7 @@ func GetFutureGoodProfitChartInfoDetailFromUniqueCode(chartInfo *data_manage.Cha
 			myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 			myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				msg = "获取失败"
 				errMsg = "获取我的图表信息失败,GetMyChartByCondition,Err: " + err.Error()
 				return

+ 7 - 7
controllers/data_manage/gpr_risk_data.go

@@ -44,7 +44,7 @@ func (this *BaseFromGprRiskController) GprRiskClassify() {
 	}
 
 	classifyAll, err := data_manage.GetAllBaseFromGprRiskClassify()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -172,8 +172,8 @@ func (this *BaseFromGprRiskController) GprRiskIndexData() {
 			return
 		}
 		if len(dataTimes) > 0 {
-			startDate := dataTimes[len(dataTimes)-1]
-			endDate := dataTimes[0]
+			startDate := utils.GormDateStrToDateStr(dataTimes[len(dataTimes)-1])
+			endDate := utils.GormDateStrToDateStr(dataTimes[0])
 			// 把截止日往后加1天
 			endDateT, _ := time.ParseInLocation(utils.FormatDate, endDate, time.Local)
 			endDate = endDateT.AddDate(0, 0, 1).Format(utils.FormatDate)
@@ -355,7 +355,7 @@ func (this *BaseFromGprRiskController) GprRiskSingleData() {
 		return
 	}
 	edbInfo, err := data_manage.GetEdbInfoByEdbCode(utils.DATA_SOURCE_GPR_RISK, indexCode)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取数据源失败"
 		br.ErrMsg = "获取数据源失败,Err:" + err.Error()
 		return
@@ -405,7 +405,7 @@ func (this *BaseFromGprRiskController) GprRiskIndexList() {
 	}()
 	classifyId, _ := this.GetInt("ClassifyId", 0)
 	indexList, err := data_manage.GetGprRiskIndexByClassifyId(classifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 		return
@@ -489,7 +489,7 @@ func (this *BaseFromGprRiskController) GprRiskNameCheck() {
 			EdbName: v.EdbName,
 		})
 		dataItems, err := data_manage.GetEdbDataAllByEdbCode(v.EdbCode, utils.DATA_SOURCE_GPR_RISK, 0, utils.EDB_DATA_LIMIT)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取钢联已存在信息失败,Err:" + err.Error()
 			return
@@ -792,7 +792,7 @@ func (this *BaseFromGprRiskController) ExportGprRiskList() {
 	if classifyId > 0 {
 		classifyInfo, err := data_manage.GetBaseFromGprRiskClassifyById(classifyId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "分类不存在"
 				return
 			}

+ 12 - 12
controllers/data_manage/line_equation/line_chart_classify.go

@@ -36,7 +36,7 @@ func (this *LineEquationChartClassifyController) ChartClassifyList() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -64,14 +64,14 @@ func (this *LineEquationChartClassifyController) ChartClassifyList() {
 	source := utils.CHART_SOURCE_LINE_EQUATION
 
 	rootList, err := data_manage.GetChartClassifyByParentId(0, source)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	allChartInfo, err := data_manage.GetChartInfoAll([]int{source})
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 		return
@@ -113,14 +113,14 @@ func (this *LineEquationChartClassifyController) ChartClassifyList() {
 func getChartClassifyListForMe(adminInfo system.Admin, resp *data_manage.ChartClassifyListResp) (errMsg string, err error) {
 	// 获取所有的分类
 	rootList, err := data_manage.GetChartClassifyByParentId(0, utils.CHART_SOURCE_LINE_EQUATION)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
 
 	// /获取所有的图表
 	allChartInfo, err := data_manage.GetChartInfoByAdminId([]int{utils.CHART_SOURCE_LINE_EQUATION}, adminInfo.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
@@ -312,7 +312,7 @@ func (this *LineEquationChartClassifyController) DeleteChartClassifyCheck() {
 
 	if deleteStatus != 1 && req.ChartInfoId == 0 {
 		classifyCount, err := data_manage.GetChartClassifyCountByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "分类下是否含有图表失败,Err:" + err.Error()
 			return
@@ -374,7 +374,7 @@ func (this *LineEquationChartClassifyController) DeleteChartClassify() {
 	if req.ChartClassifyId > 0 && req.ChartInfoId == 0 {
 		//判断是否含有指标
 		count, err := data_manage.GetChartInfoCountByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
 			return
@@ -398,7 +398,7 @@ func (this *LineEquationChartClassifyController) DeleteChartClassify() {
 	if req.ChartInfoId > 0 {
 		chartInfo, err := data_manage.GetChartInfoById(req.ChartInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "图表已删除,请刷新页面"
 				br.ErrMsg = "指标不存在,Err:" + err.Error()
 				return
@@ -461,7 +461,7 @@ func (this *LineEquationChartClassifyController) DeleteChartClassify() {
 		pars = append(pars, req.ChartInfoId)
 
 		nextItem, err := data_manage.GetChartInfoByCondition(condition, pars)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
 			return
@@ -481,14 +481,14 @@ func (this *LineEquationChartClassifyController) DeleteChartClassify() {
 			pars = append(pars, chartInfo.ChartClassifyId)
 
 			classifyItem, err := data_manage.GetChartClassifyByCondition(condition, pars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "删除失败"
 				br.ErrMsg = "获取下一级图库分类信息失败,Err:" + err.Error()
 				return
 			}
 			if classifyItem != nil {
 				nextItem, err = data_manage.GetNextChartInfo(chartInfo.ChartClassifyId)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					br.Msg = "删除失败"
 					br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
 					return
@@ -623,7 +623,7 @@ func (this *LineEquationChartClassifyController) ChartClassifyMove() {
 
 	} else {
 		firstClassify, err := data_manage.GetFirstChartClassifyByParentId(chartClassifyInfo.ParentId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "获取获取当前父级分类下的排序第一条的分类信息失败,Err:" + err.Error()
 			return

+ 21 - 21
controllers/data_manage/line_equation/line_chart_info.go

@@ -413,7 +413,7 @@ func (this *LineEquationChartInfoController) Move() {
 	if chartInfo.ChartClassifyId != req.ChartClassifyId {
 		//查询需要修改的分类下是否存在同一个图表名称
 		tmpChartInfo, tmpErr := data_manage.GetChartInfoByClassifyIdAndName(req.ChartClassifyId, chartInfo.ChartName)
-		if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
+		if tmpErr != nil && !utils.IsErrNoRow(tmpErr) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "移动失败,Err:" + tmpErr.Error()
 			return
@@ -472,7 +472,7 @@ func (this *LineEquationChartInfoController) Move() {
 
 	} else {
 		firstClassify, err := data_manage.GetFirstChartInfoByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "获取获取当前父级分类下的排序第一条的分类信息失败,Err:" + err.Error()
 			return
@@ -588,7 +588,7 @@ func (this *LineEquationChartInfoController) List() {
 
 	if chartClassifyId > 0 {
 		chartClassifyId, err := data_manage.GetChartClassify(chartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取图表信息失败"
 			br.ErrMsg = "获取信息失败,GetChartClassify,Err:" + err.Error()
 			return
@@ -628,7 +628,7 @@ func (this *LineEquationChartInfoController) List() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -646,7 +646,7 @@ func (this *LineEquationChartInfoController) List() {
 
 	//获取图表信息
 	list, err := data_manage.GetChartListByCondition(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
@@ -654,7 +654,7 @@ func (this *LineEquationChartInfoController) List() {
 	}
 
 	myChartList, err := data_manage.GetMyChartListByAdminId(sysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取我的图表信息失败,Err:" + err.Error()
 		return
@@ -698,7 +698,7 @@ func (this *LineEquationChartInfoController) List() {
 	}
 
 	resp := new(data_manage.ChartListResp)
-	if list == nil || len(list) <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || len(list) <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		items := make([]*data_manage.ChartInfoView, 0)
 		resp.Paging = page
 		resp.List = items
@@ -709,7 +709,7 @@ func (this *LineEquationChartInfoController) List() {
 	}
 
 	dataCount, err := data_manage.GetChartListCountByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取指标信息失败"
 		br.ErrMsg = "获取指标数据总数失败,Err:" + err.Error()
 		return
@@ -760,7 +760,7 @@ func (this *LineEquationChartInfoController) Detail() {
 	chartInfo := new(data_manage.ChartInfoView)
 	chartInfo, err = data_manage.GetChartInfoViewById(chartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图被删除,请刷新页面"
 			br.ErrMsg = "图被删除,请刷新页面,Err:" + err.Error()
 			return
@@ -834,7 +834,7 @@ func (this *LineEquationChartInfoController) Detail() {
 			myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 			myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 				return
@@ -962,7 +962,7 @@ func (this *LineEquationChartInfoController) DetailFromUniqueCode() {
 	status := true
 	chartInfo, err := data_manage.GetChartInfoViewByUniqueCode(uniqueCode)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			status = false
 		} else {
 			br.Msg = "获取失败"
@@ -1000,7 +1000,7 @@ func (this *LineEquationChartInfoController) DetailFromUniqueCode() {
 					myCond += ` AND a.chart_info_id=? `
 					myPars = append(myPars, chartInfo.ChartInfoId)
 					myList, err := data_manage.GetMyChartByCondition(myCond, myPars)
-					if err != nil && err.Error() != utils.ErrNoRow() {
+					if err != nil && !utils.IsErrNoRow(err) {
 						br.Msg = "获取失败"
 						br.ErrMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 						return
@@ -1076,7 +1076,7 @@ func (this *LineEquationChartInfoController) Refresh() {
 		chartInfo, err = data_manage.GetChartInfoByUniqueCode(uniqueCode)
 	}
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,无需刷新"
 			br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 			return
@@ -1236,7 +1236,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 				myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 				myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					msg = "获取失败"
 					errMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 					return
@@ -1400,7 +1400,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 			myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 			myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				msg = "获取失败"
 				errMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 				return
@@ -1496,7 +1496,7 @@ func (this *LineEquationChartInfoController) EnInfoEdit() {
 	//判断指标名称是否存在
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,请刷新页面"
 			br.ErrMsg = "图表已被删除,请刷新页面"
 			return
@@ -1514,7 +1514,7 @@ func (this *LineEquationChartInfoController) EnInfoEdit() {
 		pars = append(pars, req.ChartInfoId, req.ChartNameEn, utils.CHART_SOURCE_LINE_EQUATION)
 		existItem, err := data_manage.GetChartInfoByCondition(condition, pars)
 		if err != nil {
-			if err.Error() != utils.ErrNoRow() {
+			if !utils.IsErrNoRow(err) {
 				br.Msg = "判断英文图表名称是否存在失败"
 				br.ErrMsg = "判断英文图表名称是否存在失败,Err:" + err.Error()
 				return
@@ -1623,7 +1623,7 @@ func (this *LineEquationChartInfoController) SearchByEs() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -1637,7 +1637,7 @@ func (this *LineEquationChartInfoController) SearchByEs() {
 		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 	} else {
 		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 			return
@@ -1739,7 +1739,7 @@ func (this *LineEquationChartInfoController) BaseInfoEdit() {
 	//判断指标名称是否存在
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,请刷新页面"
 			br.ErrMsg = "图表已被删除,请刷新页面"
 			return
@@ -1764,7 +1764,7 @@ func (this *LineEquationChartInfoController) BaseInfoEdit() {
 		pars = append(pars, req.ChartName)
 		existItem, err := data_manage.GetChartInfoByCondition(condition, pars)
 		if err != nil {
-			if err.Error() != utils.ErrNoRow() {
+			if !utils.IsErrNoRow(err) {
 				br.Msg = "判断英文图表名称是否存在失败"
 				br.ErrMsg = "判断英文图表名称是否存在失败,Err:" + err.Error()
 				return

+ 43 - 39
controllers/data_manage/line_feature/chart_info.go

@@ -65,7 +65,7 @@ func (this *LineFeaturesChartInfoController) MultipleGraphConfigSave() {
 	if err != nil {
 		br.Msg = "指标A异常"
 		br.ErrMsg = "指标A异常,err:" + err.Error()
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = `指标A不存在`
 			br.IsSendEmail = false
 		}
@@ -226,7 +226,7 @@ func (this *LineFeaturesChartInfoController) MultipleGraphPreview() {
 	// 标准差图表信息
 	{
 		// 配置了数据才有返回
-		if req.StandardDeviation.CalculateValue > 0 {
+		if req.StandardDeviation.CalculateValue > 1 {
 			tmpChartInfo := *chartInfo
 			tmpChartInfo.ChartName = fmt.Sprintf("%s%d期滚动标准差", edbInfoMapping.EdbName, req.StandardDeviation.CalculateValue)
 
@@ -554,11 +554,15 @@ func (this *LineFeaturesChartInfoController) MultipleGraphConfigSaveChart() {
 	}
 
 	multipleGraphConfigChartMapping, err := data_manage.GetMultipleGraphConfigChartMappingByIdAndSource(req.MultipleGraphConfigId, req.Source)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = `保存失败`
 		br.ErrMsg = "获取配置与图表的关联关系失败,ERR:" + err.Error()
 		return
 	}
+	// 兼容gorm
+	if multipleGraphConfigChartMapping != nil && multipleGraphConfigChartMapping.Id <= 0 {
+		multipleGraphConfigChartMapping = nil
+	}
 
 	err = nil
 	var isAdd bool
@@ -567,13 +571,13 @@ func (this *LineFeaturesChartInfoController) MultipleGraphConfigSaveChart() {
 		isAdd = true
 	} else {
 		chartInfo, err := data_manage.GetChartInfoById(multipleGraphConfigChartMapping.ChartInfoId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = `保存失败`
 			br.ErrMsg = "获取图表信息失败,ERR:" + err.Error()
 			return
 		}
 		// 说明图还在,没有被删除
-		if chartInfo != nil {
+		if chartInfo != nil && chartInfo.ChartInfoId > 0 {
 			chartInfoId = multipleGraphConfigChartMapping.ChartInfoId
 			req.ChartName = chartInfo.ChartName
 			req.ClassifyId = chartInfo.ChartClassifyId
@@ -812,7 +816,7 @@ func (this *LineFeaturesChartInfoController) MultipleGraphConfigSaveChart() {
 			br.ErrMsg = "保存配置与图表的关联关系失败,ERR:" + err.Error()
 			return
 		}
-	} else if multipleGraphConfigChartMapping != nil {
+	} else if multipleGraphConfigChartMapping != nil && multipleGraphConfigChartMapping.MultipleGraphConfigId > 0 {
 		multipleGraphConfigChartMapping.ChartInfoId = chartInfo.ChartInfoId
 		multipleGraphConfigChartMapping.ModifyTime = time.Now()
 		err = multipleGraphConfigChartMapping.Update([]string{"ChartInfoId", "ModifyTime"})
@@ -866,7 +870,7 @@ func CopyMultipleGraphConfigSaveChart(req request.SaveMultipleGraphChartReq, thi
 	}
 
 	multipleGraphConfigChartMapping, err := data_manage.GetMultipleGraphConfigChartMappingByIdAndSource(req.MultipleGraphConfigId, req.Source)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = `保存失败`
 		br.ErrMsg = "获取配置与图表的关联关系失败,ERR:" + err.Error()
 		return
@@ -874,7 +878,7 @@ func CopyMultipleGraphConfigSaveChart(req request.SaveMultipleGraphChartReq, thi
 
 	// 原图
 	oldChartInfo, err := data_manage.GetChartInfoById(multipleGraphConfigChartMapping.ChartInfoId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = `保存失败`
 		br.ErrMsg = "获取图表信息失败,ERR:" + err.Error()
 		return
@@ -1064,7 +1068,7 @@ func (this *LineFeaturesChartInfoController) MultipleGraphConfigSaveEdb() {
 	}
 
 	multipleGraphConfigEdbMapping, err := data_manage.GetMultipleGraphConfigEdbMappingByIdAndSource(req.MultipleGraphConfigId, req.Source)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = `保存失败`
 		br.ErrMsg = "获取配置与图表的关联关系失败,ERR:" + err.Error()
 		return
@@ -1072,17 +1076,17 @@ func (this *LineFeaturesChartInfoController) MultipleGraphConfigSaveEdb() {
 	err = nil
 	var isAdd bool
 	var edbInfoId int
-	if multipleGraphConfigEdbMapping == nil {
+	if multipleGraphConfigEdbMapping == nil || multipleGraphConfigEdbMapping.MultipleGraphConfigId <= 0 {
 		isAdd = true
 	} else {
 		edbInfo, err := data_manage.GetEdbInfoById(multipleGraphConfigEdbMapping.EdbInfoId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = `保存失败`
 			br.ErrMsg = "获取图表信息失败,ERR:" + err.Error()
 			return
 		}
 		// 说明指标还在,没有被删除
-		if edbInfo != nil && !req.IsSaveAs {
+		if edbInfo != nil && edbInfo.EdbInfoId > 0 && !req.IsSaveAs {
 			edbInfoId = multipleGraphConfigEdbMapping.EdbInfoId
 			req.EdbName = edbInfo.EdbName
 			req.ClassifyId = edbInfo.ClassifyId
@@ -1463,12 +1467,12 @@ func (this *LineFeaturesChartInfoController) Move() {
 	if chartInfo.ChartClassifyId != req.ChartClassifyId {
 		//查询需要修改的分类下是否存在同一个图表名称
 		tmpChartInfo, tmpErr := data_manage.GetChartInfoByClassifyIdAndName(req.ChartClassifyId, chartInfo.ChartName)
-		if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
+		if tmpErr != nil && !utils.IsErrNoRow(tmpErr) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "移动失败,Err:" + tmpErr.Error()
 			return
 		}
-		if tmpChartInfo != nil {
+		if tmpChartInfo != nil && tmpChartInfo.ChartInfoId > 0 {
 			br.Msg = "移动失败,同一个分类下图表名称不允许重复"
 			br.ErrMsg = "移动失败,同一个分类下图表名称不允许重复"
 			return
@@ -1522,14 +1526,14 @@ func (this *LineFeaturesChartInfoController) Move() {
 
 	} else {
 		firstClassify, err := data_manage.GetFirstChartInfoByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "获取获取当前父级分类下的排序第一条的分类信息失败,Err:" + err.Error()
 			return
 		}
 
 		//如果该分类下存在其他分类,且第一个其他分类的排序等于0,那么需要调整排序
-		if firstClassify != nil && firstClassify.Sort == 0 {
+		if firstClassify != nil && firstClassify.ChartClassifyId > 0 && firstClassify.Sort == 0 {
 			updateSortStr := ` sort + 1 `
 			_ = data_manage.UpdateChartInfoSortByClassifyId(firstClassify.ChartClassifyId, 0, firstClassify.ChartInfoId-1, []int{utils.CHART_SOURCE_LINE_FEATURE_STANDARD_DEVIATION, utils.CHART_SOURCE_LINE_FEATURE_PERCENTILE, utils.CHART_SOURCE_LINE_FEATURE_FREQUENCY}, updateSortStr)
 		}
@@ -1633,7 +1637,7 @@ func (this *LineFeaturesChartInfoController) List() {
 
 	if chartClassifyId > 0 {
 		chartClassifyId, err := data_manage.GetChartClassify(chartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取图表信息失败"
 			br.ErrMsg = "获取信息失败,GetChartClassify,Err:" + err.Error()
 			return
@@ -1671,7 +1675,7 @@ func (this *LineFeaturesChartInfoController) List() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -1689,7 +1693,7 @@ func (this *LineFeaturesChartInfoController) List() {
 
 	//获取图表信息
 	list, err := data_manage.GetChartListByCondition(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
@@ -1697,7 +1701,7 @@ func (this *LineFeaturesChartInfoController) List() {
 	}
 
 	myChartList, err := data_manage.GetMyChartListByAdminId(sysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取我的图表信息失败,Err:" + err.Error()
 		return
@@ -1741,7 +1745,7 @@ func (this *LineFeaturesChartInfoController) List() {
 	}
 
 	resp := new(data_manage.ChartListResp)
-	if list == nil || len(list) <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || len(list) <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		items := make([]*data_manage.ChartInfoView, 0)
 		resp.Paging = page
 		resp.List = items
@@ -1752,7 +1756,7 @@ func (this *LineFeaturesChartInfoController) List() {
 	}
 
 	dataCount, err := data_manage.GetChartListCountByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取指标信息失败"
 		br.ErrMsg = "获取指标数据总数失败,Err:" + err.Error()
 		return
@@ -1795,7 +1799,7 @@ func (this *LineFeaturesChartInfoController) Detail() {
 	chartInfo := new(data_manage.ChartInfoView)
 	chartInfo, err = data_manage.GetChartInfoViewById(chartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图被删除,请刷新页面"
 			br.ErrMsg = "图被删除,请刷新页面,Err:" + err.Error()
 			return
@@ -1920,7 +1924,7 @@ func (this *LineFeaturesChartInfoController) Detail() {
 	}
 
 	// 判断是否加入我的图库
-	if chartInfoId > 0 && chartInfo != nil {
+	if chartInfoId > 0 && chartInfo != nil && chartInfo.ChartInfoId > 0 {
 		{
 			var myChartCondition string
 			var myChartPars []interface{}
@@ -1930,7 +1934,7 @@ func (this *LineFeaturesChartInfoController) Detail() {
 			myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 			myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 				return
@@ -2058,7 +2062,7 @@ func (this *LineFeaturesChartInfoController) DetailFromUniqueCode() {
 	status := true
 	chartInfo, err := data_manage.GetChartInfoViewByUniqueCode(uniqueCode)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			status = false
 		} else {
 			br.Msg = "获取失败"
@@ -2096,7 +2100,7 @@ func (this *LineFeaturesChartInfoController) DetailFromUniqueCode() {
 					myCond += ` AND a.chart_info_id=? `
 					myPars = append(myPars, chartInfo.ChartInfoId)
 					myList, err := data_manage.GetMyChartByCondition(myCond, myPars)
-					if err != nil && err.Error() != utils.ErrNoRow() {
+					if err != nil && !utils.IsErrNoRow(err) {
 						br.Msg = "获取失败"
 						br.ErrMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 						return
@@ -2172,7 +2176,7 @@ func (this *LineFeaturesChartInfoController) Refresh() {
 		chartInfo, err = data_manage.GetChartInfoByUniqueCode(uniqueCode)
 	}
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,无需刷新"
 			br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 			return
@@ -2254,7 +2258,7 @@ func (this *LineFeaturesChartInfoController) Copy() {
 	}
 
 	multipleGraphConfigChartMapping, err := data_manage.GetMultipleGraphConfigChartMappingByChartId(oldChartInfo.ChartInfoId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = `保存失败`
 		br.ErrMsg = "获取配置与图表的关联关系失败,ERR:" + err.Error()
 		return
@@ -2338,7 +2342,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 				myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 				myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					msg = "获取失败"
 					errMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 					return
@@ -2414,7 +2418,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 		if !isOk {
 			if errMsg != "" {
 				uniqueCode := ""
-				if chartInfo != nil {
+				if chartInfo != nil && chartInfo.ChartInfoId > 0 {
 					uniqueCode = chartInfo.UniqueCode
 				}
 				tmpTip := fmt.Sprintf("查询图表详情失败,line_feature.GetChartInfoDetailFromUniqueCode UniqueCode:%s,err:%s", uniqueCode, errMsg)
@@ -2532,7 +2536,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 		return
 	}
 
-	if chartInfo.ChartInfoId > 0 && chartInfo != nil {
+	if chartInfo != nil && chartInfo.ChartInfoId > 0 {
 		//判断是否加入我的图库
 		{
 			var myChartCondition string
@@ -2543,7 +2547,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 			myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 			myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				msg = "获取失败"
 				errMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 				return
@@ -2639,7 +2643,7 @@ func (this *LineFeaturesChartInfoController) EnInfoEdit() {
 	//判断指标名称是否存在
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,请刷新页面"
 			br.ErrMsg = "图表已被删除,请刷新页面"
 			return
@@ -2657,7 +2661,7 @@ func (this *LineFeaturesChartInfoController) EnInfoEdit() {
 		pars = append(pars, req.ChartInfoId, req.ChartNameEn, utils.CHART_SOURCE_LINE_FEATURE_STANDARD_DEVIATION, utils.CHART_SOURCE_LINE_FEATURE_PERCENTILE, utils.CHART_SOURCE_LINE_FEATURE_FREQUENCY)
 		existItem, err := data_manage.GetChartInfoByCondition(condition, pars)
 		if err != nil {
-			if err.Error() != utils.ErrNoRow() {
+			if !utils.IsErrNoRow(err) {
 				br.Msg = "判断英文图表名称是否存在失败"
 				br.ErrMsg = "判断英文图表名称是否存在失败,Err:" + err.Error()
 				return
@@ -2766,7 +2770,7 @@ func (this *LineFeaturesChartInfoController) SearchByEs() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -2780,7 +2784,7 @@ func (this *LineFeaturesChartInfoController) SearchByEs() {
 		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 	} else {
 		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 			return
@@ -2882,7 +2886,7 @@ func (this *LineFeaturesChartInfoController) BaseInfoEdit() {
 	//判断指标名称是否存在
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,请刷新页面"
 			br.ErrMsg = "图表已被删除,请刷新页面"
 			return
@@ -2908,7 +2912,7 @@ func (this *LineFeaturesChartInfoController) BaseInfoEdit() {
 		pars = append(pars, req.ChartName)
 		existItem, err := data_manage.GetChartInfoByCondition(condition, pars)
 		if err != nil {
-			if err.Error() != utils.ErrNoRow() {
+			if !utils.IsErrNoRow(err) {
 				br.Msg = "判断英文图表名称是否存在失败"
 				br.ErrMsg = "判断英文图表名称是否存在失败,Err:" + err.Error()
 				return

+ 12 - 12
controllers/data_manage/line_feature/classify.go

@@ -36,7 +36,7 @@ func (this *LineFeaturesChartClassifyController) ChartClassifyList() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -64,14 +64,14 @@ func (this *LineFeaturesChartClassifyController) ChartClassifyList() {
 	source := utils.CHART_SOURCE_LINE_FEATURE_STANDARD_DEVIATION
 
 	rootList, err := data_manage.GetChartClassifyByParentId(0, source)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	allChartInfo, err := data_manage.GetChartInfoAll([]int{utils.CHART_SOURCE_LINE_FEATURE_STANDARD_DEVIATION, utils.CHART_SOURCE_LINE_FEATURE_PERCENTILE, utils.CHART_SOURCE_LINE_FEATURE_FREQUENCY})
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 		return
@@ -113,14 +113,14 @@ func (this *LineFeaturesChartClassifyController) ChartClassifyList() {
 func getChartClassifyListForMe(adminInfo system.Admin, resp *data_manage.ChartClassifyListResp) (errMsg string, err error) {
 	// 获取所有的分类
 	rootList, err := data_manage.GetChartClassifyByParentId(0, utils.CHART_SOURCE_LINE_FEATURE_STANDARD_DEVIATION)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
 
 	// /获取所有的图表
 	allChartInfo, err := data_manage.GetChartInfoByAdminId([]int{utils.CHART_SOURCE_LINE_FEATURE_STANDARD_DEVIATION, utils.CHART_SOURCE_LINE_FEATURE_PERCENTILE, utils.CHART_SOURCE_LINE_FEATURE_FREQUENCY}, adminInfo.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
@@ -312,7 +312,7 @@ func (this *LineFeaturesChartClassifyController) DeleteChartClassifyCheck() {
 
 	if deleteStatus != 1 && req.ChartInfoId == 0 {
 		classifyCount, err := data_manage.GetChartClassifyCountByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "分类下是否含有图表失败,Err:" + err.Error()
 			return
@@ -374,7 +374,7 @@ func (this *LineFeaturesChartClassifyController) DeleteChartClassify() {
 	if req.ChartClassifyId > 0 && req.ChartInfoId == 0 {
 		//判断是否含有指标
 		count, err := data_manage.GetChartInfoCountByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
 			return
@@ -398,7 +398,7 @@ func (this *LineFeaturesChartClassifyController) DeleteChartClassify() {
 	if req.ChartInfoId > 0 {
 		chartInfo, err := data_manage.GetChartInfoById(req.ChartInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "图表已删除,请刷新页面"
 				br.ErrMsg = "指标不存在,Err:" + err.Error()
 				return
@@ -461,7 +461,7 @@ func (this *LineFeaturesChartClassifyController) DeleteChartClassify() {
 		pars = append(pars, req.ChartInfoId)
 
 		nextItem, err := data_manage.GetChartInfoByCondition(condition, pars)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
 			return
@@ -481,14 +481,14 @@ func (this *LineFeaturesChartClassifyController) DeleteChartClassify() {
 			pars = append(pars, chartInfo.ChartClassifyId)
 
 			classifyItem, err := data_manage.GetChartClassifyByCondition(condition, pars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "删除失败"
 				br.ErrMsg = "获取下一级图库分类信息失败,Err:" + err.Error()
 				return
 			}
 			if classifyItem != nil {
 				nextItem, err = data_manage.GetNextChartInfo(chartInfo.ChartClassifyId)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					br.Msg = "删除失败"
 					br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
 					return
@@ -623,7 +623,7 @@ func (this *LineFeaturesChartClassifyController) ChartClassifyMove() {
 
 	} else {
 		firstClassify, err := data_manage.GetFirstChartClassifyByParentId(chartClassifyInfo.ParentId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "获取获取当前父级分类下的排序第一条的分类信息失败,Err:" + err.Error()
 			return

+ 11 - 13
controllers/data_manage/manual.go

@@ -2,13 +2,13 @@ package data_manage
 
 import (
 	"encoding/json"
-	"fmt"
 	"eta/eta_api/controllers"
 	"eta/eta_api/models"
 	"eta/eta_api/models/data_manage"
 	"eta/eta_api/models/system"
 	"eta/eta_api/services/data"
 	"eta/eta_api/utils"
+	"fmt"
 	"strconv"
 	"strings"
 	"time"
@@ -224,12 +224,12 @@ func (this *ChartClassifyController) AddManualClassify() {
 	}
 
 	classifyItem, err := data_manage.GetManualClassifyByClassifyName(req.ClassifyName)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "判断名称是否已存在失败"
 		br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
 		return
 	}
-	if classifyItem != nil {
+	if classifyItem != nil && classifyItem.ClassifyId > 0 {
 		if classifyItem.IsShow == 1 {
 			br.Msg = "分类名称已存在,请重新输入"
 			br.IsSendEmail = false
@@ -243,7 +243,7 @@ func (this *ChartClassifyController) AddManualClassify() {
 				return
 			}
 			parentItem, _ := data_manage.GetManualClassifyById(req.ParentId)
-			if parentItem != nil && parentItem.IsShow == 0 {
+			if parentItem != nil && parentItem.ClassifyId > 0 && parentItem.IsShow == 0 {
 				err = data_manage.ModifyManualClassifyIsShow(1, parentItem.ClassifyId, req.ParentId)
 				if err != nil {
 					br.Msg = "保存失败"
@@ -315,17 +315,15 @@ func (this *ChartClassifyController) ManualClassifyEdit() {
 		return
 	}
 	classifyItem, err := data_manage.GetManualClassifyByClassifyName(req.ClassifyName)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "修改失败"
 		br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
 		return
 	}
 
-	if classifyItem != nil {
-		if item.ClassifyId != classifyItem.ClassifyId {
-			br.Msg = "名称已存在,请重新输入"
-			return
-		}
+	if classifyItem != nil && classifyItem.ClassifyId > 0 && item.ClassifyId != classifyItem.ClassifyId {
+		br.Msg = "名称已存在,请重新输入"
+		return
 	}
 
 	err = data_manage.ModifyManualClassifyName(req.ClassifyName, req.ClassifyId, req.ParentId)
@@ -364,7 +362,7 @@ func (this *ChartClassifyController) ManualClassifyDel() {
 		return
 	}
 	classifyItem, err := data_manage.GetManualClassifyById(req.ClassifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "查找分类失败"
 		br.ErrMsg = "查找分类失败,Err:" + err.Error()
 		return
@@ -377,7 +375,7 @@ func (this *ChartClassifyController) ManualClassifyDel() {
 
 	// 获取当前分类下是否存在子分类
 	count, err := data_manage.GetChildManualClassifyCount(req.ClassifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "删除失败"
 		br.ErrMsg = "根据分类id获取下面存在的子分类数量失败,Err:" + err.Error()
 		return
@@ -391,7 +389,7 @@ func (this *ChartClassifyController) ManualClassifyDel() {
 	if classifyItem.ParentId > 0 {
 		// 获取当前分类下的指标数
 		count, err = data_manage.GetManualEdbInfoCountByClassifyId(req.ClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "根据分类id获取下面存在的指标数量失败,Err:" + err.Error()
 			return

+ 17 - 10
controllers/data_manage/multiple_graph_config.go

@@ -61,7 +61,7 @@ func (this *ChartInfoController) MultipleGraphConfigSave() {
 	if err != nil {
 		br.Msg = "指标A异常"
 		br.ErrMsg = "指标A异常,err:" + err.Error()
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = `指标A不存在`
 			br.IsSendEmail = false
 		}
@@ -81,7 +81,7 @@ func (this *ChartInfoController) MultipleGraphConfigSave() {
 	if err != nil {
 		br.Msg = "指标B异常"
 		br.ErrMsg = "指标B异常,err:" + err.Error()
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = `指标B不存在`
 			br.IsSendEmail = false
 		}
@@ -676,11 +676,14 @@ func (this *ChartInfoController) MultipleGraphConfigSaveChart() {
 	}
 
 	multipleGraphConfigChartMapping, err := data_manage.GetMultipleGraphConfigChartMappingByIdAndSource(req.MultipleGraphConfigId, req.Source)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = `保存失败`
 		br.ErrMsg = "获取配置与图表的关联关系失败,ERR:" + err.Error()
 		return
 	}
+	if multipleGraphConfigChartMapping != nil && multipleGraphConfigChartMapping.Id <= 0 {
+		multipleGraphConfigChartMapping = nil
+	}
 
 	err = nil
 	var isAdd bool
@@ -689,13 +692,13 @@ func (this *ChartInfoController) MultipleGraphConfigSaveChart() {
 		isAdd = true
 	} else {
 		chartInfo, err := data_manage.GetChartInfoById(multipleGraphConfigChartMapping.ChartInfoId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = `保存失败`
 			br.ErrMsg = "获取图表信息失败,ERR:" + err.Error()
 			return
 		}
 		// 说明图还在,没有被删除
-		if chartInfo != nil {
+		if chartInfo != nil && chartInfo.ChartInfoId > 0 {
 			chartInfoId = multipleGraphConfigChartMapping.ChartInfoId
 			req.ChartName = chartInfo.ChartName
 			req.ClassifyId = chartInfo.ChartClassifyId
@@ -1018,7 +1021,7 @@ func CopyMultipleGraphConfigSaveChart(req request.SaveMultipleGraphChartReq, thi
 	}
 
 	multipleGraphConfigChartMapping, err := data_manage.GetMultipleGraphConfigChartMappingByIdAndSource(req.MultipleGraphConfigId, req.Source)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = `保存失败`
 		br.ErrMsg = "获取配置与图表的关联关系失败,ERR:" + err.Error()
 		return
@@ -1026,7 +1029,7 @@ func CopyMultipleGraphConfigSaveChart(req request.SaveMultipleGraphChartReq, thi
 
 	// 原图
 	oldChartInfo, err := data_manage.GetChartInfoById(multipleGraphConfigChartMapping.ChartInfoId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = `保存失败`
 		br.ErrMsg = "获取图表信息失败,ERR:" + err.Error()
 		return
@@ -1275,11 +1278,15 @@ func (this *ChartInfoController) MultipleGraphConfigSaveEdb() {
 	}
 
 	multipleGraphConfigEdbMapping, err := data_manage.GetMultipleGraphConfigEdbMappingByIdAndSource(req.MultipleGraphConfigId, req.Source)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = `保存失败`
 		br.ErrMsg = "获取配置与图表的关联关系失败,ERR:" + err.Error()
 		return
 	}
+	if multipleGraphConfigEdbMapping != nil && multipleGraphConfigEdbMapping.Id <= 0 {
+		multipleGraphConfigEdbMapping = nil
+	}
+
 	err = nil
 	var isAdd bool
 	var edbInfoId int
@@ -1287,13 +1294,13 @@ func (this *ChartInfoController) MultipleGraphConfigSaveEdb() {
 		isAdd = true
 	} else {
 		edbInfo, err := data_manage.GetEdbInfoById(multipleGraphConfigEdbMapping.EdbInfoId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = `保存失败`
 			br.ErrMsg = "获取图表信息失败,ERR:" + err.Error()
 			return
 		}
 		// 说明指标还在,没有被删除
-		if edbInfo != nil && !req.IsSaveAs {
+		if edbInfo != nil && edbInfo.EdbInfoId > 0 && !req.IsSaveAs {
 			edbInfoId = multipleGraphConfigEdbMapping.EdbInfoId
 			req.EdbName = edbInfo.EdbName
 			req.ClassifyId = edbInfo.ClassifyId

+ 41 - 45
controllers/data_manage/my_chart.go

@@ -129,7 +129,7 @@ func (this *MyChartController) ChartList() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -147,7 +147,7 @@ func (this *MyChartController) ChartList() {
 
 	//获取图表信息
 	list, err := data_manage.GetChartListByCondition(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
@@ -155,7 +155,7 @@ func (this *MyChartController) ChartList() {
 	}
 
 	myChartList, err := data_manage.GetMyChartListByAdminId(sysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取我的图表信息失败,Err:" + err.Error()
 		return
@@ -232,7 +232,7 @@ func (this *MyChartController) ChartList() {
 	}
 
 	resp := new(data_manage.ChartListResp)
-	if list == nil || len(list) <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || len(list) <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		items := make([]*data_manage.ChartInfoView, 0)
 		resp.Paging = page
 		resp.List = items
@@ -243,7 +243,7 @@ func (this *MyChartController) ChartList() {
 	}
 
 	dataCount, err := data_manage.GetChartListCountByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取指标信息失败"
 		br.ErrMsg = "获取指标数据总数失败,Err:" + err.Error()
 		return
@@ -278,7 +278,7 @@ func (this *MyChartController) ClassifyList() {
 	}
 	//获取图表信息
 	list, err := data_manage.GetMyChartClassifyAll(sysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取分类信息失败"
 		br.ErrMsg = "获取分类信息失败,Err:" + err.Error()
@@ -286,7 +286,7 @@ func (this *MyChartController) ClassifyList() {
 	}
 
 	resp := new(data_manage.MyChartClassifyResp)
-	if list == nil || len(list) <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || len(list) <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		items := make([]*data_manage.MyChartClassifyItem, 0)
 		resp.List = items
 		br.Ret = 200
@@ -458,7 +458,7 @@ func (this *MyChartController) ClassifyEdit() {
 		return
 	}
 	item, err := data_manage.GetMyChartClassifyById(sysUser.AdminId, req.MyChartClassifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "保存失败"
 		br.ErrMsg = "获取分类信息失败,Err:" + err.Error()
 		return
@@ -546,7 +546,7 @@ func (this *MyChartController) ClassifyMove() {
 	}
 	//查询该分类存不存在
 	item, err := data_manage.GetMyChartClassifyById(sysUser.AdminId, req.MyChartClassifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "移动失败,找不到该分类"
 		br.ErrMsg = "获取分类信息失败,Err:" + err.Error()
 		return
@@ -596,14 +596,14 @@ func (this *MyChartController) ClassifyMove() {
 		updateCol = append(updateCol, "Sort", "ModifyTime")
 	} else {
 		firstClassify, err := data_manage.GetFirstMyChartClassifyByAdminId(sysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "移动失败"
 			br.ErrMsg = "获取获取当前账号下的排序第一条的分类信息失败,Err:" + err.Error()
 			return
 		}
 
 		//如果该分类下存在其他分类,且第一个其他分类的排序等于0,那么需要调整排序
-		if firstClassify != nil && firstClassify.Sort == 0 {
+		if firstClassify != nil && firstClassify.MyChartClassifyId > 0 && firstClassify.Sort == 0 {
 			updateSortStr := ` sort + 1 `
 			_ = data_manage.UpdateMyChartClassifySortByClassifyId(sysUser.AdminId, firstClassify.MyChartClassifyId-1, 0, updateSortStr)
 		}
@@ -670,7 +670,7 @@ func (this *MyChartController) ClassifyDelete() {
 	}
 
 	item, err := data_manage.GetMyChartClassifyById(sysUser.AdminId, req.MyChartClassifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "保存失败"
 		br.ErrMsg = "获取分类信息失败,Err:" + err.Error()
 		return
@@ -769,7 +769,7 @@ func (this *MyChartController) MyChartAdd() {
 	}
 
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取图表信息失败!"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 		return
@@ -790,14 +790,14 @@ func (this *MyChartController) MyChartAdd() {
 	pars = append(pars, req.ChartInfoId)
 
 	existItem, err := data_manage.GetMyChartDetailByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "保存失败"
 		br.ErrMsg = "保存失败,校验名称是否存在失败,Err:" + err.Error()
 		return
 	}
 	resp := new(data_manage.MyChartAddResp)
 	var myChartClassifyId string
-	if existItem != nil { //修改
+	if existItem != nil && existItem.MyChartId > 0 { //修改
 		fmt.Println("modify")
 		for _, v := range req.MyChartClassifyId {
 			myChartClassifyId += strconv.Itoa(v) + ","
@@ -830,7 +830,7 @@ func (this *MyChartController) MyChartAdd() {
 			var sort float64
 			// 查找最小排序值
 			firstMapItem, _ := data_manage.GetMyChartSort(sysUser.AdminId, v, 0)
-			if firstMapItem != nil {
+			if firstMapItem != nil && firstMapItem.MyChartClassifyMappingId > 0 {
 				sort = firstMapItem.Sort
 			}
 			//获取最大的排序字段
@@ -910,7 +910,7 @@ func (this *MyChartController) MyChartAddToClassify() {
 	}
 
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取图表信息失败!"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 		return
@@ -931,14 +931,14 @@ func (this *MyChartController) MyChartAddToClassify() {
 	pars = append(pars, req.ChartInfoId)
 
 	existItem, err := data_manage.GetMyChartDetailByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "保存失败"
 		br.ErrMsg = "保存失败,校验名称是否存在失败,Err:" + err.Error()
 		return
 	}
 	resp := new(data_manage.MyChartAddResp)
 	var myChartClassifyId string
-	if existItem != nil { //修改
+	if existItem != nil && existItem.MyChartId > 0 { //修改
 		fmt.Println("modify")
 		for _, v := range req.MyChartClassifyId {
 			myChartClassifyId += strconv.Itoa(v) + ","
@@ -1051,9 +1051,9 @@ func (this *MyChartController) GetMyChartClassifyIdList() {
 	pars = append(pars, sysUser.AdminId, chartInfoId)
 
 	existItem, _ := data_manage.GetMyChartDetailByCondition(condition, pars)
-	if existItem != nil {
+	if existItem != nil && existItem.MyChartId > 0 {
 		myChartClassifyList, err := data_manage.GetMyChartClassifyList(existItem.MyChartId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取图表信息失败!"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 			return
@@ -1275,7 +1275,7 @@ func (this *MyChartController) MyChartList() {
 		if isShared {
 			myClassify, e := data_manage.GetMyChartClassifyByClassifyId(myChartClassifyId)
 			if e != nil {
-				if e.Error() == utils.ErrNoRow() {
+				if utils.IsErrNoRow(e) {
 					br.Msg = "分类已被删除, 请刷新页面"
 					return
 				}
@@ -1308,7 +1308,7 @@ func (this *MyChartController) MyChartList() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -1326,14 +1326,14 @@ func (this *MyChartController) MyChartList() {
 
 	//获取图表信息
 	list, err := data_manage.GetMyChartListByCondition(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 		return
 	}
 	myChartList, err := data_manage.GetMyChartListByAdminId(sysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取我的图表信息失败,Err:" + err.Error()
 		return
@@ -1408,7 +1408,7 @@ func (this *MyChartController) MyChartList() {
 	}
 
 	resp := new(data_manage.MyChartListResp)
-	if list == nil || len(list) <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || len(list) <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		items := make([]*data_manage.MyChartList, 0)
 		resp.Paging = page
 		resp.List = items
@@ -1418,7 +1418,7 @@ func (this *MyChartController) MyChartList() {
 		return
 	}
 	total, err = data_manage.GetMyChartListCountByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取我的图表数据总数失败,Err:" + err.Error()
 		return
@@ -1599,7 +1599,7 @@ func (this *MyChartController) ChartRecommendList() {
 
 	//获取图表信息
 	list, err := data_manage.GetRecommendChartListByCondition(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
@@ -1607,7 +1607,7 @@ func (this *MyChartController) ChartRecommendList() {
 	}
 
 	myChartList, err := data_manage.GetMyChartListByAdminId(sysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取我的图表信息失败,Err:" + err.Error()
 		return
@@ -1658,7 +1658,7 @@ func (this *MyChartController) ChartRecommendList() {
 	}
 
 	resp := new(data_manage.ChartRecommendListResp)
-	if list == nil || len(list) <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || len(list) <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		items := make([]*data_manage.ChartInfoView, 0)
 		resp.List = items
 		br.Ret = 200
@@ -1707,7 +1707,7 @@ func (this *MyChartController) MyChartSearch() {
 
 	//获取图表信息
 	list, err := data_manage.GetMyChartSearchByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
@@ -1802,7 +1802,7 @@ func (this *MyChartController) MyChartSearchByEs() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -1919,7 +1919,7 @@ func (this *MyChartController) PublicClassifyList() {
 	}
 	//获取图表信息
 	list, err := data_manage.GetPublicChartClassifyAllExceptMy(sysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取公共分类信息失败"
 		br.ErrMsg = "获取公共分类信息失败,Err:" + err.Error()
@@ -1927,7 +1927,7 @@ func (this *MyChartController) PublicClassifyList() {
 	}
 
 	resp := new(data_manage.PublicChartClassifyResp)
-	if list == nil || len(list) <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || len(list) <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		resp.List = make([]data_manage.PublicChartClassifyList, 0)
 		br.Ret = 200
 		br.Success = true
@@ -1989,11 +1989,11 @@ func (this *MyChartController) PublicClassifyList() {
 	// 指标显示的语言
 	{
 		configDetail, _ := system.GetConfigDetailByCode(this.SysUser.AdminId, system.ChartLanguageVar)
-		if configDetail != nil {
+		if configDetail != nil && configDetail.ConfigId > 0 {
 			language = configDetail.ConfigValue
 		} else {
 			configDetail, _ = system.GetDefaultConfigDetailByCode(system.ChartLanguageVar)
-			if configDetail != nil {
+			if configDetail != nil && configDetail.ConfigId > 0 {
 				language = configDetail.ConfigValue
 			}
 		}
@@ -2036,7 +2036,7 @@ func (this *MyChartController) ModifyClassifyPublicStatus() {
 	}
 	//查询该分类存不存在
 	item, err := data_manage.GetMyChartClassifyById(sysUser.AdminId, req.MyChartClassifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "修改失败,找不到该分类"
 		br.ErrMsg = "获取分类信息失败,Err:" + err.Error()
 		return
@@ -2108,7 +2108,7 @@ func (this *MyChartController) CopyClassifyAndChart() {
 	}
 	//查询该公共分类存不存在
 	item, err := data_manage.GetPublicMyChartClassifyById(req.MyChartClassifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "复制失败,找不到该分类"
 		br.ErrMsg = "获取分类信息失败,Err:" + err.Error()
 		return
@@ -2263,7 +2263,7 @@ func (this *MyChartController) CompanyPublicClassifyList() {
 		pars = append(pars, keyword)
 	}
 	list, err := data_manage.GetCompanyPublicClassifyList(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取用户可见分类列表失败"
 		br.ErrMsg = "获取用户可见分类列表失败, Err:" + err.Error()
@@ -2271,7 +2271,7 @@ func (this *MyChartController) CompanyPublicClassifyList() {
 	}
 
 	resp := new(data_manage.MyChartClassifyResp)
-	if list == nil || len(list) <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || len(list) <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		items := make([]*data_manage.MyChartClassifyItem, 0)
 		resp.List = items
 		br.Ret = 200
@@ -2293,10 +2293,6 @@ func (this *MyChartController) CompanyPublicClassifyList() {
 	br.Data = resp
 }
 
-//func init() {
-//	data.AddAllMyChartInfo()
-//}
-
 // ClassifyFrameworkNodeList
 // @Title 我的图表分类-关联的框架节点列表
 // @Description 我的图表分类-关联的框架节点列表
@@ -2328,7 +2324,7 @@ func (this *MyChartController) ClassifyFrameworkNodeList() {
 
 	_, e := data_manage.GetMyChartClassifyById(sysUser.AdminId, classifyId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "分类不存在, 请刷新页面"
 			return
 		}

+ 6 - 6
controllers/data_manage/mysteel_chemical_data.go

@@ -44,14 +44,14 @@ func (this *EdbInfoController) MysteelChemicalClassify() {
 	}
 
 	rootList, err := data_manage.GetBaseFromMysteelChemicalClassifyByParentId(0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	classifyAll, err := data_manage.GetAllBaseFromMysteelChemicalClassify()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -113,7 +113,7 @@ func (this *EdbInfoController) MysteelChemicalIndexList() {
 		return
 	}
 	allBaseFromMysteelChemicalIndex, err := data_manage.GetMysteelChemicalIndexByClassifyId(classifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 		return
@@ -594,7 +594,7 @@ func (this *EdbInfoController) MysteelChemicalData() {
 			dataList = make([]*data_manage.MysteelChemicalData, 0)
 		}
 		edbInfo, err := data_manage.GetEdbInfoByEdbCode(utils.DATA_SOURCE_MYSTEEL_CHEMICAL, v.IndexCode)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取数据失败"
 			br.ErrMsg = "获取指标库统计数据失败,Err:" + err.Error()
 			return
@@ -1327,7 +1327,7 @@ func (c *EdbInfoController) NameCheck() {
 			EdbName: v.EdbName,
 		})
 		dataItems, err := data_manage.GetEdbDataAllByEdbCode(v.EdbCode, utils.DATA_SOURCE_MYSTEEL_CHEMICAL, 0, utils.EDB_DATA_LIMIT)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取钢联已存在信息失败,Err:" + err.Error()
 			return
@@ -1585,7 +1585,7 @@ func (this *EdbInfoController) Add() {
 
 	tmpInfo, err := data_manage.GetBaseFromMysteelChemicalIndexByCode(req.EdbCode)
 	if err != nil {
-		if err.Error() != utils.ErrNoRow() {
+		if !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取失败,Err:" + err.Error()
 			return

+ 3 - 3
controllers/data_manage/predict_edb_classify.go

@@ -702,7 +702,7 @@ func (this *PredictEdbClassifyController) SimpleList() {
 	}
 
 	rootList, err := data_manage.GetEdbClassifyByParentId(parentId, 1)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -715,7 +715,7 @@ func (this *PredictEdbClassifyController) SimpleList() {
 		// 获取当前账号的不可见指标
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -845,7 +845,7 @@ func (this *PredictEdbClassifyController) ClassifyTree() {
 	}()
 
 	allList, err := data_manage.GetPredictEdbClassifyAll()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return

+ 16 - 20
controllers/data_manage/predict_edb_info.go

@@ -80,7 +80,7 @@ func (this *PredictEdbInfoController) EdbChartList() {
 	// 筛选分类
 	if classifyId > 0 {
 		childClassify, e, _ := data.GetChildClassifyByClassifyId(classifyId)
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取分类信息失败, GetEdbClassify,Err:" + e.Error()
 			return
@@ -104,7 +104,7 @@ func (this *PredictEdbInfoController) EdbChartList() {
 	// 获取当前账号的不可见指标
 	obj := data_manage.EdbInfoNoPermissionAdmin{}
 	confList, err := obj.GetAllListByAdminId(this.SysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 		return
@@ -120,14 +120,14 @@ func (this *PredictEdbInfoController) EdbChartList() {
 	}
 	//获取指标信息
 	dataCount, list, err := data_manage.GetEdbInfoFilterList(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取预测指标列表失败"
 		br.ErrMsg = "获取预测指标列表失败,Err:" + err.Error()
 		return
 	}
 
-	if list == nil || len(list) <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || len(list) <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		list = make([]*data_manage.EdbInfoList, 0)
 	} else {
 		classifyIdList := make([]int, 0)
@@ -245,14 +245,14 @@ func (this *PredictEdbInfoController) List() {
 	}
 	//获取指标信息
 	edbInfoItem, err := data_manage.GetEdbInfoByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取指标信息失败"
 		br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 		return
 	}
 
-	if edbInfoItem == nil || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if edbInfoItem == nil || (err != nil && utils.IsErrNoRow(err)) {
 		item := new(data_manage.EdbInfoList)
 		resp.Paging = page
 		resp.Item = item
@@ -289,7 +289,7 @@ func (this *PredictEdbInfoController) List() {
 	//获取指标数据(实际已生成)
 	{
 		dataCount, dataList, err := data.GetPageData(edbInfoItem.EdbInfoId, edbInfoItem.Source, edbInfoItem.SubSource, edbInfoItem.LatestDate, startSize, pageSize)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取指标信息失败"
 			br.ErrMsg = "获取指标数据总数失败,Err:" + err.Error()
 			return
@@ -561,7 +561,7 @@ func (this *PredictEdbInfoController) ChartImageSet() {
 		if err != nil {
 			br.Msg = "保存失败"
 			br.ErrMsg = "保存失败,Err:" + err.Error()
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "找不到该指标"
 				br.ErrMsg = "找不到该指标"
 				br.IsSendEmail = false
@@ -926,7 +926,7 @@ func (this *PredictEdbInfoController) Detail() {
 	if edbInfo.EdbType == 1 {
 		// 获取所有的指标预测规则配置
 		tmpPredictEdbConfList, err := data_manage.GetPredictEdbConfListById(edbInfoId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取预测指标配置信息失败,Err:" + err.Error()
 			return
@@ -935,7 +935,7 @@ func (this *PredictEdbInfoController) Detail() {
 			var tmpPredictEdbConfCalculateMappingDetail []*data_manage.PredictEdbConfCalculateMappingDetail
 			if v.RuleType == 9 || v.RuleType == 14 {
 				tmpPredictEdbConfCalculateMappingDetail, err = data_manage.GetPredictEdbConfCalculateMappingDetailListByConfigId(v.PredictEdbInfoId, v.ConfigId)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					br.Msg = "获取失败"
 					br.ErrMsg = "获取预测指标配置与关联指标信息失败,Err:" + err.Error()
 					return
@@ -1177,7 +1177,7 @@ func (this *PredictEdbInfoController) FilterByEs() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -1614,7 +1614,7 @@ func (this *PredictEdbInfoController) ChartDataList() {
 		endNumList := make([]int, 0)
 		for _, v := range req.RuleList {
 			if req.EndDateType == 0 {
-				confEndDate, err := time.Parse(utils.FormatDate, v.EndDate)
+				confEndDate, err := time.ParseInLocation(utils.FormatDate, v.EndDate, time.Local)
 				if err != nil {
 					br.Msg = "配置项中时间异常,请重新选择"
 					br.ErrMsg = "配置项中时间异常,请重新选择,err:" + err.Error()
@@ -1751,7 +1751,7 @@ func (this *PredictEdbInfoController) ChartDataList() {
 	if err != nil {
 		br.Msg = "获取来源指标信息失败"
 		br.ErrMsg = "获取来源指标信息失败"
-		if err.Error() != utils.ErrNoRow() {
+		if !utils.IsErrNoRow(err) {
 			br.ErrMsg = "获取来源指标信息失败,Err:" + err.Error()
 		}
 		br.Success = true
@@ -2050,10 +2050,6 @@ func (this *PredictEdbInfoController) Modify() {
 //
 //}
 
-//func init() {
-//	data.AddOrEditAllEdbInfoToEs()
-//}
-
 // ClassifyEdbInfoItems
 // @Title 获取分类下指标接口
 // @Description 获取分类下指标接口
@@ -2080,7 +2076,7 @@ func (this *PredictEdbInfoController) ClassifyEdbInfoItems() {
 	// 获取当前账号的不可见指标
 	obj := data_manage.EdbInfoNoPermissionAdmin{}
 	confList, err := obj.GetAllListByAdminId(this.SysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 		return
@@ -2097,7 +2093,7 @@ func (this *PredictEdbInfoController) ClassifyEdbInfoItems() {
 	}
 
 	allEdbInfo, err := data_manage.GetEdbInfoByClassifyId(classifyId, 1, sysUserId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -2213,7 +2209,7 @@ func (this *PredictEdbInfoController) ChartImageSetBySvg() {
 	if err != nil {
 		br.Msg = "保存失败"
 		br.ErrMsg = "保存失败,Err:" + err.Error()
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "找不到该指标"
 			br.ErrMsg = "找不到该指标"
 			br.IsSendEmail = false

+ 12 - 12
controllers/data_manage/range_analysis/chart_classify.go

@@ -61,7 +61,7 @@ func (this *RangeChartClassifyController) ChartClassifyList() {
 	nodeAll := make([]*data_manage.ChartClassifyItems, 0)
 	// 查询分类节点
 	rootList, err := data_manage.GetChartClassifyByParentId(parentId, utils.CHART_SOURCE_RANGE_ANALYSIS)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -154,19 +154,19 @@ func (this *RangeChartClassifyController) ChartClassifyList() {
 // getChartClassifyListForMe 获取我创建的图表
 func getChartClassifyListForMe(adminInfo system.Admin, resp *data_manage.ChartClassifyListResp) (errMsg string, err error) {
 	rootList, err := data_manage.GetChartClassifyByParentId(0, utils.CHART_SOURCE_RANGE_ANALYSIS)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
 
 	classifyAll, err := data_manage.GetChartClassifyAll(utils.CHART_SOURCE_RANGE_ANALYSIS)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
 
 	allChartInfo, err := data_manage.GetChartInfoByAdminId([]int{utils.CHART_SOURCE_RANGE_ANALYSIS, utils.CHART_SOURCE_RANGE_ANALYSIS}, adminInfo.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		errMsg = "获取失败"
 		return
 	}
@@ -366,7 +366,7 @@ func (this *RangeChartClassifyController) DeleteChartClassifyCheck() {
 
 	if deleteStatus != 1 && req.ChartInfoId == 0 {
 		classifyCount, err := data_manage.GetChartClassifyCountByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "分类下是否含有图表失败,Err:" + err.Error()
 			return
@@ -428,7 +428,7 @@ func (this *RangeChartClassifyController) DeleteChartClassify() {
 	if req.ChartClassifyId > 0 && req.ChartInfoId == 0 {
 		//判断是否含有指标
 		count, err := data_manage.GetChartInfoCountByClassifyId(req.ChartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
 			return
@@ -452,7 +452,7 @@ func (this *RangeChartClassifyController) DeleteChartClassify() {
 	if req.ChartInfoId > 0 {
 		chartInfo, err := data_manage.GetChartInfoById(req.ChartInfoId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "图表已删除,请刷新页面"
 				br.ErrMsg = "指标不存在,Err:" + err.Error()
 				return
@@ -503,7 +503,7 @@ func (this *RangeChartClassifyController) DeleteChartClassify() {
 		chartSeriesOb := new(data_manage.FactorEdbSeriesChartMapping)
 		seriesMappingItem, e := chartSeriesOb.GetItemByChartInfoId(chartInfo.ChartInfoId)
 		if e != nil {
-			if e.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(e) {
 			} else {
 				br.Msg = "删除失败"
 				br.ErrMsg = "获取图表关联失败, Err: " + e.Error()
@@ -527,7 +527,7 @@ func (this *RangeChartClassifyController) DeleteChartClassify() {
 		}
 		// 删除配置关联指标数据
 		multiConfig, e := data_manage.GetMultipleGraphConfigChartMappingByChartId(chartInfo.ChartInfoId)
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "获取图表关联配置失败, Err: " + e.Error()
 			return
@@ -550,7 +550,7 @@ func (this *RangeChartClassifyController) DeleteChartClassify() {
 		pars = append(pars, req.ChartInfoId)
 
 		nextItem, err := data_manage.GetChartInfoByCondition(condition, pars)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
 			return
@@ -570,14 +570,14 @@ func (this *RangeChartClassifyController) DeleteChartClassify() {
 			pars = append(pars, chartInfo.ChartClassifyId)
 
 			classifyItem, err := data_manage.GetChartClassifyByCondition(condition, pars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "删除失败"
 				br.ErrMsg = "获取下一级图库分类信息失败,Err:" + err.Error()
 				return
 			}
 			if classifyItem != nil {
 				nextItem, err = data_manage.GetNextChartInfo(chartInfo.ChartClassifyId)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					br.Msg = "删除失败"
 					br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
 					return

+ 21 - 21
controllers/data_manage/range_analysis/chart_info.go

@@ -73,7 +73,7 @@ func (this *RangeChartChartInfoController) Preview() {
 	for _, v := range req.ChartEdbInfoList {
 		edbInfoMapping, e := data_manage.GetChartEdbMappingByEdbInfoId(v.EdbInfoId)
 		if e != nil {
-			if e.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(e) {
 				br.Msg = v.EdbAliasName + "指标不存在"
 				br.ErrMsg = v.EdbAliasName + "指标不存在"
 				return
@@ -336,7 +336,7 @@ func (this *RangeChartChartInfoController) Detail() {
 	chartInfo := new(data_manage.ChartInfoView)
 	chartInfo, err = data_manage.GetChartInfoViewById(chartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图被删除,请刷新页面"
 			br.ErrMsg = "图被删除,请刷新页面,Err:" + err.Error()
 			return
@@ -415,7 +415,7 @@ func (this *RangeChartChartInfoController) Detail() {
 			myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 			myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 				return
@@ -564,7 +564,7 @@ func (this *RangeChartChartInfoController) DetailFromUniqueCode() {
 	status := true
 	chartInfo, err := data_manage.GetChartInfoViewByUniqueCode(uniqueCode)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			status = false
 		} else {
 			br.Msg = "获取失败"
@@ -602,7 +602,7 @@ func (this *RangeChartChartInfoController) DetailFromUniqueCode() {
 					myCond += ` AND a.chart_info_id=? `
 					myPars = append(myPars, chartInfo.ChartInfoId)
 					myList, err := data_manage.GetMyChartByCondition(myCond, myPars)
-					if err != nil && err.Error() != utils.ErrNoRow() {
+					if err != nil && !utils.IsErrNoRow(err) {
 						br.Msg = "获取失败"
 						br.ErrMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 						return
@@ -659,7 +659,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 				myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 				myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-				if err != nil && err.Error() != utils.ErrNoRow() {
+				if err != nil && !utils.IsErrNoRow(err) {
 					msg = "获取失败"
 					errMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 					return
@@ -826,7 +826,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 			myChartPars = append(myChartPars, chartInfo.ChartInfoId)
 
 			myChartList, err := data_manage.GetMyChartByCondition(myChartCondition, myChartPars)
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				msg = "获取失败"
 				errMsg = "获取我的图表信息失败,GetMyChartByCondition,Err:" + err.Error()
 				return
@@ -937,7 +937,7 @@ func (this *RangeChartChartInfoController) List() {
 
 	if chartClassifyId > 0 {
 		chartClassifyId, err := data_manage.GetChartClassify(chartClassifyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取图表信息失败"
 			br.ErrMsg = "获取信息失败,GetChartClassify,Err:" + err.Error()
 			return
@@ -969,7 +969,7 @@ func (this *RangeChartChartInfoController) List() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -987,7 +987,7 @@ func (this *RangeChartChartInfoController) List() {
 
 	//获取图表信息
 	list, err := data_manage.GetChartListByCondition(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
@@ -995,7 +995,7 @@ func (this *RangeChartChartInfoController) List() {
 	}
 
 	myChartList, err := data_manage.GetMyChartListByAdminId(sysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取图表信息失败"
 		br.ErrMsg = "获取我的图表信息失败,Err:" + err.Error()
 		return
@@ -1039,7 +1039,7 @@ func (this *RangeChartChartInfoController) List() {
 	}
 
 	resp := new(data_manage.ChartListResp)
-	if list == nil || len(list) <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || len(list) <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		items := make([]*data_manage.ChartInfoView, 0)
 		resp.Paging = page
 		resp.List = items
@@ -1050,7 +1050,7 @@ func (this *RangeChartChartInfoController) List() {
 	}
 
 	dataCount, err := data_manage.GetChartListCountByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取指标信息失败"
 		br.ErrMsg = "获取指标数据总数失败,Err:" + err.Error()
 		return
@@ -1147,7 +1147,7 @@ func (this *RangeChartChartInfoController) Copy() {
 
 		_, e = data_manage.GetChartClassifyById(req.ChartClassifyId)
 		if e != nil {
-			if e.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(e) {
 				br.Msg = "分类不存在"
 				return
 			}
@@ -1160,7 +1160,7 @@ func (this *RangeChartChartInfoController) Copy() {
 	// 图表信息
 	originChart, e := data_manage.GetChartInfoById(req.ChartInfoId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "原图表不存在"
 			return
 		}
@@ -1253,7 +1253,7 @@ func (this *RangeChartChartInfoController) Refresh() {
 		chartInfo, err = data_manage.GetChartInfoByUniqueCode(uniqueCode)
 	}
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,无需刷新"
 			br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 			return
@@ -1827,7 +1827,7 @@ func (this *RangeChartChartInfoController) SearchByEs() {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllChartListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -1841,7 +1841,7 @@ func (this *RangeChartChartInfoController) SearchByEs() {
 		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 	} else {
 		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
 			return
@@ -1942,7 +1942,7 @@ func (this *RangeChartChartInfoController) BaseInfoEdit() {
 
 	chartItem, e := data_manage.GetChartInfoById(req.ChartInfoId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "图表已被删除, 请刷新页面"
 			return
 		}
@@ -1970,7 +1970,7 @@ func (this *RangeChartChartInfoController) BaseInfoEdit() {
 	pars = append(pars, req.ChartName)
 	existItem, err := data_manage.GetChartInfoByCondition(condition, pars)
 	if err != nil {
-		if err.Error() != utils.ErrNoRow() {
+		if !utils.IsErrNoRow(err) {
 			br.Msg = "判断英文图表名称是否存在失败"
 			br.ErrMsg = "判断英文图表名称是否存在失败,Err:" + err.Error()
 			return
@@ -2063,7 +2063,7 @@ func (this *RangeChartChartInfoController) ChartInfoSave() {
 
 	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "图表已被删除,请刷新页面!"
 			br.ErrMsg = "图表已被删除,请刷新页面,ChartInfoId:" + strconv.Itoa(req.ChartInfoId)
 			return

+ 5 - 5
controllers/data_manage/sci_data.go

@@ -36,14 +36,14 @@ func (this *EdbInfoController) SciClassify() {
 	}
 
 	rootList, err := data_manage.GetBaseFromSciClassifyByParentId(0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	classifyAll, err := data_manage.GetAllBaseFromSciClassify()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -52,7 +52,7 @@ func (this *EdbInfoController) SciClassify() {
 	baseFromSciIndexMap := make(map[int][]*data_manage.BaseFromSciClassifyItems)
 
 	allBaseFromSciIndex, err := data_manage.GetSciIndexAll()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 		return
@@ -144,14 +144,14 @@ func (this *EdbInfoController) SciClassifyName() {
 	}
 
 	rootList, err := data_manage.GetBaseFromSciClassifyByParentId(0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	classifyAll, err := data_manage.GetAllBaseFromSciClassify()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return

+ 7 - 7
controllers/data_manage/sci_hq_data.go

@@ -180,7 +180,7 @@ func (this *SciHqDataController) EditClassify() {
 	}
 	classify, err := data_manage.GetSciHqClassifyById(req.ClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在"
 			return
 		}
@@ -295,7 +295,7 @@ func (this *SciHqDataController) IndexList() {
 	}()
 	classifyId, _ := this.GetInt("ClassifyId", 0)
 	indexList, err := data_manage.GetSciHqIndexBaseInfoByClassifyId(classifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 		return
@@ -429,7 +429,7 @@ func (this *SciHqDataController) IndexPageList() {
 		}
 		total = tmpTotal
 		tmpIndexList, err := data_manage.GetSciHqIndexByPage(startSize, pageSize)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 			return
@@ -457,7 +457,7 @@ func (this *SciHqDataController) IndexPageList() {
 		}
 		total = tmpTotal
 		tmpIndexList, err := data_manage.GetSciHqIndexByClassifyId(classifyIds, startSize, pageSize)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 			return
@@ -534,7 +534,7 @@ func (this *SciHqDataController) SingleData() {
 		return
 	}
 	edbInfo, err := data_manage.GetEdbInfoByEdbCode(utils.DATA_SOURCE_SCI_HQ, indexInfo.IndexCode)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取指标数据失败"
 		br.ErrMsg = "获取指标库数据失败,Err:" + err.Error()
 		return
@@ -736,7 +736,7 @@ func (this *SciHqDataController) AddEdbInfo() {
 
 	_, err = data_manage.GetSciHqIndexByIndexCode(req.EdbCode)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "指标不存在"
 			return
 		}
@@ -947,7 +947,7 @@ func (c *SciHqDataController) NameCheck() {
 			EdbName: v.EdbName,
 		})
 		dataItems, err := data_manage.GetEdbDataAllByEdbCode(v.EdbCode, utils.DATA_SOURCE_SCI_HQ, 0, utils.EDB_DATA_LIMIT)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取卓创红期已存在信息失败,Err:" + err.Error()
 			return

+ 4 - 4
controllers/data_manage/smm_data.go

@@ -37,14 +37,14 @@ func (this *EdbInfoController) SmmClassify() {
 	}
 
 	rootList, err := data_manage.GetBaseFromSmmClassifyByParentId(0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	classifyAll, err := data_manage.GetAllBaseFromSmmClassify()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -196,14 +196,14 @@ func (this *EdbInfoController) SmmClassifyName() {
 	}
 
 	rootList, err := data_manage.GetBaseFromSmmClassifyByParentId(0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	classifyAll, err := data_manage.GetAllBaseFromSmmClassify()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return

+ 7 - 7
controllers/data_manage/supply_analysis/variety.go

@@ -76,7 +76,7 @@ func (this *VarietyController) List() {
 		}
 		total, list, err = varietyObj.GetListByPage(condition, pars, startSize, pageSize)
 	}
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -146,12 +146,12 @@ func (this *VarietyController) Add() {
 	}
 	varietyName := utils.TrimStr(req.VarietyName)
 	item, err := supply_analysis.GetVarietyByName(varietyName)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "添加失败"
 		br.ErrMsg = "添加失败,Err:" + err.Error()
 		return
 	}
-	if item != nil {
+	if item != nil && item.VarietyId > 0 {
 		br.Msg = "添加失败,品种名称不能重复"
 		br.IsSendEmail = false
 		return
@@ -219,7 +219,7 @@ func (this *VarietyController) Edit() {
 	varietyName := utils.TrimStr(req.VarietyName)
 
 	item, err := supply_analysis.GetVarietyByName(varietyName)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "添加失败"
 		br.ErrMsg = "添加失败,Err:" + err.Error()
 		return
@@ -364,7 +364,7 @@ func (this *VarietyController) Delete() {
 
 	varietyInfo, err := supply_analysis.GetVarietyById(req.VarietyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "该品种不存在或已删除"
 			br.IsSendEmail = false
 		} else {
@@ -411,7 +411,7 @@ func (this *VarietyController) Detail() {
 	if err != nil {
 		br.Msg = "查询品种失败"
 		br.ErrMsg = "查询品种失败;ERR:" + err.Error()
-		if err.Error() != utils.ErrNoRow() {
+		if !utils.IsErrNoRow(err) {
 			br.Msg = "不存在该品种或该品种已被删除"
 			br.ErrMsg = "不存在该品种或该品种已被删除"
 			br.IsSendEmail = false
@@ -626,7 +626,7 @@ func (this *VarietyController) ModifyProductionDay() {
 	var hasPermission bool //是否有操作权限
 	// 是否有装置的操作权限
 	hasPermission, err = supply_analysisServ.HasVarietyPlantPermission(this.SysUser, req.VarietyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "查询是否有装置的操作权限失败;ERR:" + err.Error()
 		return

+ 6 - 6
controllers/data_manage/supply_analysis/variety_edb.go

@@ -57,7 +57,7 @@ func (this *VarietyController) EdbList() {
 	var hasPermission bool //是否有操作权限
 	// 是否有装置的操作权限
 	hasPermission, err = supply_analysisServ.HasVarietyPlantPermission(this.SysUser, varietyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "查询是否有装置的操作权限失败;ERR:" + err.Error()
 		return
@@ -65,7 +65,7 @@ func (this *VarietyController) EdbList() {
 
 	var list []*supply_analysis.VarietyEdbInfoItem
 	list, err = supply_analysis.GetAllVarietyEdbInfoByVarietyId(varietyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -206,7 +206,7 @@ func (this *VarietyController) AddToEdb() {
 
 	varietyEdbInfo, err := supply_analysis.GetVarietyEdbInfoByVarietyEdbId(req.VarietyEdbId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "找不到该指标"
 			br.IsSendEmail = false
 		} else {
@@ -219,7 +219,7 @@ func (this *VarietyController) AddToEdb() {
 	var hasPermission bool //是否有操作权限
 	// 是否有装置的操作权限
 	hasPermission, err = supply_analysisServ.HasVarietyPlantPermission(this.SysUser, varietyEdbInfo.VarietyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "查询是否有装置的操作权限失败;ERR:" + err.Error()
 		return
@@ -232,7 +232,7 @@ func (this *VarietyController) AddToEdb() {
 
 	if varietyEdbInfo.EdbInfoId > 0 {
 		tmpEdbInfo, err := data_manage.GetEdbInfoById(varietyEdbInfo.EdbInfoId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "添加失败"
 			br.ErrMsg = "查询ETA指标失败,ERR:" + err.Error()
 			return
@@ -347,7 +347,7 @@ func (this *VarietyController) EdbDataExport() {
 
 	var list []*supply_analysis.VarietyEdbInfoItem
 	list, err = supply_analysis.GetAllVarietyEdbInfoByVarietyId(varietyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return

+ 8 - 8
controllers/data_manage/supply_analysis/variety_plant.go

@@ -50,7 +50,7 @@ func (this *VarietyController) PlantList() {
 	var hasPermission bool //是否有操作权限
 	// 是否有装置的操作权限
 	hasPermission, err = supply_analysisServ.HasVarietyPlantPermission(this.SysUser, varietyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "查询是否有装置的操作权限失败;ERR:" + err.Error()
 		return
@@ -58,7 +58,7 @@ func (this *VarietyController) PlantList() {
 
 	var list []*supply_analysis.VarietyPlantItem
 	list, err = supply_analysis.GetAllVarietyPlantByVarietyId(varietyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -141,7 +141,7 @@ func (this *VarietyController) AddPlant() {
 	var hasPermission bool //是否有操作权限
 	// 是否有装置的操作权限
 	hasPermission, err = supply_analysisServ.HasVarietyPlantPermission(this.SysUser, req.VarietyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "查询是否有装置的操作权限失败;ERR:" + err.Error()
 		return
@@ -320,7 +320,7 @@ func (this *VarietyController) EditPlant() {
 	var hasPermission bool //是否有操作权限
 	// 是否有装置的操作权限
 	hasPermission, err = supply_analysisServ.HasVarietyPlantPermission(this.SysUser, varietyPlantInfo.VarietyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "查询是否有装置的操作权限失败;ERR:" + err.Error()
 		return
@@ -443,7 +443,7 @@ func (this *VarietyController) DeletePlant() {
 	}
 
 	varietyPlantInfo, err := supply_analysis.GetVarietyPlantById(req.VarietyPlantId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "删除失败"
 		br.ErrMsg = "查找品种装置失败,Err:" + err.Error()
 		return
@@ -471,7 +471,7 @@ func (this *VarietyController) DeletePlant() {
 	// 是否有装置的操作权限
 	var hasPermission bool
 	hasPermission, err = supply_analysisServ.HasVarietyPlantPermission(this.SysUser, varietyPlantInfo.VarietyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "查询是否有装置的操作权限失败;ERR:" + err.Error()
 		return
@@ -485,7 +485,7 @@ func (this *VarietyController) DeletePlant() {
 	// 保留一条装置校验
 	{
 		total, err := supply_analysis.GetCountVarietyPlantByVarietyId(varietyInfo.VarietyId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "删除失败"
 			br.ErrMsg = "查找品种装置总数量失败,Err:" + err.Error()
 			return
@@ -542,7 +542,7 @@ func (this *VarietyController) CopyPlant() {
 	var hasPermission bool //是否有操作权限
 	// 是否有装置的操作权限
 	hasPermission, err = supply_analysisServ.HasVarietyPlantPermission(this.SysUser, req.VarietyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "查询是否有装置的操作权限失败;ERR:" + err.Error()
 		return

+ 6 - 6
controllers/data_manage/usda_fas_data.go

@@ -44,7 +44,7 @@ func (this *BaseFromUsdaFasController) UsdaFasClassify() {
 	}
 
 	classifyAll, err := data_manage.GetAllBaseFromUsdaFasClassify()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -134,7 +134,7 @@ func (this *BaseFromUsdaFasController) UsdaFasIndexData() {
 	if classifyId >= 0 {
 		classifyInfo, err := data_manage.GetBaseFromUsdaFasClassifyById(classifyId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "分类不存在"
 				return
 			}
@@ -371,7 +371,7 @@ func (this *BaseFromUsdaFasController) UsdaFasSingleData() {
 		return
 	}
 	edbInfo, err := data_manage.GetEdbInfoByEdbCode(utils.DATA_SOURCE_USDA_FAS, indexCode)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取数据源失败"
 		br.ErrMsg = "获取数据源失败,Err:" + err.Error()
 		return
@@ -421,7 +421,7 @@ func (this *BaseFromUsdaFasController) UsdaFasIndexList() {
 	}()
 	classifyId, _ := this.GetInt("ClassifyId", 0)
 	indexList, err := data_manage.GetUsdaFasIndexByClassifyId(classifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 		return
@@ -736,7 +736,7 @@ func (this *BaseFromUsdaFasController) UsdaFasNameCheck() {
 			EdbName: v.EdbName,
 		})
 		dataItems, err := data_manage.GetEdbDataAllByEdbCode(v.EdbCode, utils.DATA_SOURCE_USDA_FAS, 0, utils.EDB_DATA_LIMIT)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取钢联已存在信息失败,Err:" + err.Error()
 			return
@@ -1039,7 +1039,7 @@ func (this *BaseFromUsdaFasController) ExportUsdaFasList() {
 	if classifyId > 0 {
 		classifyInfo, err := data_manage.GetBaseFromUsdaFasClassifyById(classifyId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "分类不存在"
 				return
 			}

+ 7 - 7
controllers/data_manage/wind_data.go

@@ -29,7 +29,7 @@ func (this *EdbInfoController) WindClassify() {
 	parentId, _ := this.GetInt("ParentId")
 	// 特殊处理顶级分类
 	rootList, err := data_manage.GetEdbClassifyByParentId(parentId, 0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -38,7 +38,7 @@ func (this *EdbInfoController) WindClassify() {
 	if parentId == 0 {
 		// 查询wind指标的所有一级分类
 		classifyIdList, e := data_manage.GetEdbClassifyIdListBySource(utils.DATA_SOURCE_WIND)
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取分类列表失败,Err:" + e.Error()
 			return
@@ -53,7 +53,7 @@ func (this *EdbInfoController) WindClassify() {
 		}
 		// 查询wind指标的所有一级分类下的指标信息
 		rootIds, e := data_manage.GetEdbClassifyRootIdsByClassifyIds(classifyIdList)
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取分类列表失败,Err:" + e.Error()
 			return
@@ -70,7 +70,7 @@ func (this *EdbInfoController) WindClassify() {
 		// 获取当前账号的不可见指标
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, err := obj.GetAllListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
 			return
@@ -218,7 +218,7 @@ func (this *EdbInfoController) WindEdbInfoList() {
 	edbInfoId, _ := this.GetInt("EdbInfoId")
 	if classifyId > 0 {
 		childClassify, e, _ := data.GetChildClassifyByClassifyId(classifyId)
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取分类信息失败, GetEdbClassify,Err:" + e.Error()
 			return
@@ -270,7 +270,7 @@ func (this *EdbInfoController) WindEdbInfoList() {
 		if classifyId > 0 { // todo 当没有传入分类ID时,如何处理 同一个分类ID,顶级分类是一样的
 			targetClassify, err := data_manage.GetEdbClassifyById(classifyId)
 			if err != nil {
-				if err.Error() == utils.ErrNoRow() {
+				if utils.IsErrNoRow(err) {
 					br.Msg = "当前分类不存在"
 					return
 				}
@@ -279,7 +279,7 @@ func (this *EdbInfoController) WindEdbInfoList() {
 				return
 			}
 			targetClassifyList, err = data_manage.GetEdbClassifyByRootIdLevel(targetClassify.RootId, targetClassify.ClassifyType, "")
-			if err != nil && err.Error() != utils.ErrNoRow() {
+			if err != nil && !utils.IsErrNoRow(err) {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取分类信息失败,Err:" + err.Error()
 				return

+ 10 - 8
controllers/data_manage/yongyi_data.go

@@ -40,7 +40,7 @@ func (this *EdbInfoController) YongyiClassify() {
 	}
 
 	classifyAll, err := data_manage.GetAllBaseFromYongyiClassify()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -128,7 +128,7 @@ func (this *EdbInfoController) YongyiIndexData() {
 	if classifyId >= 0 {
 		classifyInfo, err := data_manage.GetBaseFromYongyiClassifyById(classifyId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "分类不存在"
 				return
 			}
@@ -320,7 +320,7 @@ func (this *EdbInfoController) YongyiSingleData() {
 		return
 	}
 	edbInfo, err := data_manage.GetEdbInfoByEdbCode(utils.DATA_SOURCE_YONYI, indexCode)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取数据源失败"
 		br.ErrMsg = "获取数据源失败,Err:" + err.Error()
 		return
@@ -343,7 +343,7 @@ func (this *EdbInfoController) YongyiSingleData() {
 	ret.Unit = indexInfo.Unit
 	for _, v := range dataTmpList {
 		tmp := &data_manage.YongyiSingleData{
-			Value:    v.Value,
+			Value:    v.Value.String(),
 			DataTime: v.DataTime,
 		}
 		dataList = append(dataList, tmp)
@@ -370,7 +370,7 @@ func (this *EdbInfoController) YongyiIndexList() {
 	}()
 	classifyId, _ := this.GetInt("ClassifyId", 0)
 	indexList, err := data_manage.GetYongyiIndexByClassifyId(classifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 		return
@@ -660,7 +660,7 @@ func (this *EdbInfoController) YongyiNameCheck() {
 			EdbName: v.EdbName,
 		})
 		dataItems, err := data_manage.GetEdbDataAllByEdbCode(v.EdbCode, utils.DATA_SOURCE_YONYI, 0, utils.EDB_DATA_LIMIT)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取钢联已存在信息失败,Err:" + err.Error()
 			return
@@ -962,7 +962,7 @@ func (this *EdbInfoController) ExportYongyiList() {
 	if classifyId > 0 {
 		classifyInfo, err := data_manage.GetBaseFromYongyiClassifyById(classifyId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "分类不存在"
 				return
 			}
@@ -980,9 +980,11 @@ func (this *EdbInfoController) ExportYongyiList() {
 
 		if len(childClassify) > 0 {
 			condition += `AND classify_id IN (` + utils.GetOrmInReplace(len(childClassify)) + `)`
+			var classifyIdList []int
 			for _, child := range childClassify {
-				pars = append(pars, child.ClassifyId)
+				classifyIdList = append(classifyIdList, child.ClassifyId)
 			}
+			pars = append(pars, classifyIdList)
 		} else {
 			condition += ` AND classify_id=?`
 			pars = append(pars, classifyId)

+ 14 - 1
controllers/data_source/data_source.go

@@ -124,7 +124,7 @@ func (c *DataSourceController) SearchByEs() {
 		var updateEs bool
 		if v.StartDate == "" || v.EndDate == "" || v.LatestValue == "" || v.LatestValue == "0" {
 			minMax, e := dataSourceModel.GetBaseIndexDataMinMax(v.Source, v.SubSource, v.IndexCode)
-			if e != nil && e.Error() != utils.ErrNoRow() {
+			if e != nil && !utils.IsErrNoRow(e) {
 				br.Msg = "获取失败"
 				br.ErrMsg = fmt.Sprintf("获取指标开始结束时间失败, %v", e)
 				return
@@ -260,6 +260,19 @@ func (c *DataSourceController) SearchByEs() {
 	//	}
 	//}
 
+	for _, v := range listMap {
+		classifyId, ok := v[classifyIdKey].(int)
+		if !ok {
+			v["ClassifyUniqueCode"] = ""
+			continue
+		}
+		v["ClassifyUniqueCode"] = strconv.Itoa(classifyId)
+		startDate := v["StartDate"].(string)
+		v["StartDate"] = utils.GormDateStrToDateStr(startDate)
+		endDate := v["EndDate"].(string)
+		v["EndDate"] = utils.GormDateStrToDateStr(endDate)
+	}
+
 	page := paging.GetPaging(currentIndex, pageSize, total)
 	resp := dataSourceModel.SearchDataSourceResp{
 		Paging: page,

+ 7 - 8
controllers/data_source/sci99.go

@@ -103,7 +103,6 @@ func (this *DataSourceController) Sci99Data() {
 		pars = append(pars, "%"+keyword+"%")
 	}
 
-
 	sci99List, err := data_source.GetSci99Index(condition, pars)
 	if err != nil {
 		br.Msg = "获取数据失败"
@@ -121,13 +120,13 @@ func (this *DataSourceController) Sci99Data() {
 		product.Unit = v.Unit
 		product.ModifyTime = v.ModifyTime
 
-		modifyTime, err := data_source.GetSci99IndexLatestDate(v.IndexCode)
-		if err != nil && err.Error() != utils.ErrNoRow() {
-			br.Msg = "获取更新时间失败"
-			br.ErrMsg = "获取更新时间失败,Err:" + err.Error()
-			return
-		}
-		product.ModifyTime = modifyTime
+		// modifyTime, err := data_source.GetSci99IndexLatestDate(v.IndexCode)
+		// if err != nil && !utils.IsErrNoRow(err) {
+		// 	br.Msg = "获取更新时间失败"
+		// 	br.ErrMsg = "获取更新时间失败,Err:" + err.Error()
+		// 	return
+		// }
+		// product.ModifyTime = modifyTime
 
 		total, err := data_source.GetSci99IndexDataCount(v.IndexCode)
 		page := paging.GetPaging(currentIndex, pageSize, total)

+ 25 - 26
controllers/data_stat/edb_source_stat.go

@@ -225,7 +225,7 @@ func (this *EdbSourceStatController) EdbDeleteLog() {
 	}
 	total, err := data_stat.GetEdbDeleteLogCount(condition, pars)
 	if err != nil {
-		if err.Error() != utils.ErrNoRow() {
+		if !utils.IsErrNoRow(err) {
 			br.Msg = "获取指标删除列表总数失败"
 			br.ErrMsg = "获取指标删除列表总数失败,Err:" + err.Error()
 			return
@@ -378,7 +378,7 @@ func (this *EdbSourceStatController) EdbUpdateLog() {
 	}
 	total, err := data_stat.GetEdbUpdateLogCount(condition, pars)
 	if err != nil {
-		if err.Error() != utils.ErrNoRow() {
+		if !utils.IsErrNoRow(err) {
 			br.Msg = "获取指标删除列表总数失败"
 			br.ErrMsg = "获取指标删除列表总数失败,Err:" + err.Error()
 			return
@@ -555,7 +555,7 @@ func (this *EdbSourceStatController) EdbUpdateStat() {
 	}
 	total, err := data_stat.GetEdbUpdateStatCount(condition, pars)
 	if err != nil {
-		if err.Error() != utils.ErrNoRow() {
+		if !utils.IsErrNoRow(err) {
 			br.Msg = "获取指标列表总数失败"
 			br.ErrMsg = "获取指标列表总数失败,Err:" + err.Error()
 			return
@@ -727,7 +727,7 @@ func (this *EdbSourceStatController) EdbSourceStat() {
 	}
 	total, err := data_stat.GetEdbSourceStatCount(condition, pars)
 	if err != nil {
-		if err.Error() != utils.ErrNoRow() {
+		if !utils.IsErrNoRow(err) {
 			br.Msg = "获取数据源统计列表总数失败"
 			br.ErrMsg = "获取数据源统计列表总数失败,Err:" + err.Error()
 			return
@@ -805,24 +805,27 @@ func (this *EdbSourceStatController) EdbUpdateFailedList() {
 	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)
 
+	terminalName := ""
+	terminalDir := ""
+	if terminalCode != "" {
+		terminalInfo, err := data_manage.GetEdbTerminalByTerminalCode(terminalCode)
+		if err != nil {
+			if utils.IsErrNoRow(err) {
+				br.Msg = "终端不存在"
+				return
+			}
+			br.Msg = "查询终端信息出错"
+			br.ErrMsg = "查询终端信息出错 Err:" + err.Error()
+			return
+		}
+		terminalName = terminalInfo.Name
+		terminalDir = terminalInfo.DirPath
+	}
+
 	if createTime != "" {
 		startT, err := time.ParseInLocation(utils.FormatDate, createTime, time.Local)
 		if err != nil {
@@ -856,9 +859,9 @@ func (this *EdbSourceStatController) EdbUpdateFailedList() {
 	}
 	resp := data_stat.GetEdbUpdateFailedResp{
 		List:             list,
-		Name:             terminalInfo.Name,
+		Name:             terminalName,
 		TerminalCode:     terminalCode,
-		DirPath:          terminalInfo.DirPath,
+		DirPath:          terminalDir,
 		UpdateSuccessNum: successNum,
 		UpdateFailedNum:  failedNum,
 	}
@@ -909,16 +912,12 @@ func (this *EdbSourceStatController) EdbUpdateFailedDetailList() {
 		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"
+	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)
 
@@ -935,7 +934,7 @@ func (this *EdbSourceStatController) EdbUpdateFailedDetailList() {
 
 	total, err := data_stat.GetEdbUpdateStatCount(condition, pars)
 	if err != nil {
-		if err.Error() != utils.ErrNoRow() {
+		if !utils.IsErrNoRow(err) {
 			br.Msg = "获取指标列表总数失败"
 			br.ErrMsg = "获取指标列表总数失败,Err:" + err.Error()
 			return

+ 5 - 3
controllers/document_manage/document_manage_controller.go

@@ -156,7 +156,8 @@ func (this *DocumentManageController) DocumentReportList() {
 	if currentIndex <= 0 {
 		currentIndex = 1
 	}
-	documentReportPage, err := document_manage_service.DocumentReportList(documentType, chartPermissionIdList, classifyIdList, keyword, orderField, orderType, currentIndex, pageSize)
+	startSize := utils.StartIndex(currentIndex, pageSize)
+	documentReportPage, err := document_manage_service.DocumentReportList(documentType, chartPermissionIdList, classifyIdList, keyword, orderField, orderType, startSize, pageSize)
 	if err != nil {
 		br.Msg = "获取报告列表失败"
 		br.ErrMsg = "获取报告列表失败,Err:" + err.Error()
@@ -211,7 +212,8 @@ func (this *DocumentManageController) RuiSiReportList() {
 	if currentIndex <= 0 {
 		currentIndex = 1
 	}
-	RuiSiReportPage, err := document_manage_service.RuiSiReportList(classifyIdFirst, classifyIdSecond, classifyIdThird, chartPermissionIdList, keyword, orderField, orderType, currentIndex, pageSize)
+	startSize := utils.StartIndex(currentIndex, pageSize)
+	RuiSiReportPage, err := document_manage_service.RuiSiReportList(classifyIdFirst, classifyIdSecond, classifyIdThird, chartPermissionIdList, keyword, orderField, orderType, startSize, pageSize)
 	if err != nil {
 		br.Msg = "获取报告列表失败"
 		br.ErrMsg = "获取报告列表失败,Err:" + err.Error()
@@ -257,7 +259,7 @@ func (this *DocumentManageController) DocumentRuiSiDetail() {
 
 	reportDetail, err := document_manage_service.DocumentRuiSiDetail(reportId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "报告已被删除"
 			return
 		}

+ 2 - 2
controllers/english_report/email.go

@@ -187,7 +187,7 @@ func (this *EnglishReportEmailController) Save() {
 
 	// 英文客户以邮箱为主, 邮箱去重, 手机号非必填, 此处不做手机号去重
 	exist, e := models.GetEnglishReportEmailByEmail(req.Email)
-	if e != nil && e.Error() != utils.ErrNoRow() {
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "保存失败"
 		br.ErrMsg = "获取同名邮箱失败, Err:" + e.Error()
 		return
@@ -933,7 +933,7 @@ func (this *EnglishReportEmailController) ImportListMatch() {
 	}
 	companyItem, e := models.GetEnglishCompanyById(companyId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "客户已被删除, 请刷新页面"
 			return
 		}

+ 5 - 5
controllers/english_report/en_permission.go

@@ -62,7 +62,7 @@ func (this *EnPermissionController) Add() {
 	existPars := make([]interface{}, 0)
 	existPars = append(existPars, req.PermissionName, req.ParentId)
 	exist, e := existOB.GetItemByCondition(existCond, existPars)
-	if e != nil && e.Error() != utils.ErrNoRow() {
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "操作失败"
 		br.ErrMsg = "获取重名品种权限失败, Err: " + e.Error()
 		return
@@ -143,7 +143,7 @@ func (this *EnPermissionController) Edit() {
 	existPars := make([]interface{}, 0)
 	existPars = append(existPars, req.PermissionName, req.ParentId, req.PermissionId)
 	exist, e := ob.GetItemByCondition(existCond, existPars)
-	if e != nil && e.Error() != utils.ErrNoRow() {
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "操作失败"
 		br.ErrMsg = "获取重名品种权限失败, Err: " + e.Error()
 		return
@@ -155,7 +155,7 @@ func (this *EnPermissionController) Edit() {
 
 	item, e := ob.GetItemById(req.PermissionId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "品种不存在, 请刷新页面"
 			return
 		}
@@ -384,7 +384,7 @@ func (this *EnPermissionController) Remove() {
 	ob := new(models.EnPermission)
 	item, e := ob.GetItemById(req.PermissionId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "品种不存在, 请刷新页面"
 			return
 		}
@@ -522,7 +522,7 @@ func (this *EnPermissionController) SetEnabled() {
 
 	item, e := ob.GetItemById(req.PermissionId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "品种不存在, 请刷新页面"
 			return
 		}

+ 8 - 8
controllers/english_report/english_classify.go

@@ -206,7 +206,7 @@ func (this *EnglishReportController) AddClassify() {
 	if parentId > 0 {
 		parentClassify, err := models.GetEnglishReportClassifyById(parentId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "上级分类不存在"
 				return
 			}
@@ -331,7 +331,7 @@ func (this *EnglishReportController) EditClassify() {
 
 	oldItem, err := models.GetEnglishReportClassifyById(classifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "当前分类不存在"
 			return
 		}
@@ -350,7 +350,7 @@ func (this *EnglishReportController) EditClassify() {
 	if parentId > 0 {
 		parent, err = models.GetEnglishReportClassifyById(parentId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "上级分类不存在"
 				return
 			}
@@ -377,7 +377,7 @@ func (this *EnglishReportController) EditClassify() {
 	//判断是否已存在同个名称的分类
 	existItem, e := models.GetEnglishClassifyByClassifyNameParentId(classifyName, parentId)
 	if e != nil {
-		if e.Error() != utils.ErrNoRow() {
+		if !utils.IsErrNoRow(e) {
 			br.Msg = "查询已存在的分类出错"
 			br.ErrMsg = "查询已存在的分类出错, Err:" + e.Error()
 			return
@@ -482,7 +482,7 @@ func (this *EnglishReportController) DelClassify() {
 
 	classifyInfo, err := models.GetEnglishReportClassifyById(classifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "当前分类不存在"
 			br.ErrMsg = "当前分类不存在"
 			return
@@ -505,7 +505,7 @@ func (this *EnglishReportController) DelClassify() {
 	// 	return
 	// }
 	reportCount, e := models.GetEnglishReportCounts(classifyId, classifyInfo.ParentId)
-	if e != nil && e.Error() != utils.ErrNoRow() {
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取失败,Err:" + e.Error()
 		return
@@ -517,7 +517,7 @@ func (this *EnglishReportController) DelClassify() {
 		return
 	}
 	videoCount, e := models.GetEnglishVideoCounts(classifyId, classifyInfo.ParentId)
-	if e != nil && e.Error() != utils.ErrNoRow() {
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取失败,Err:" + e.Error()
 		return
@@ -754,7 +754,7 @@ func (this *EnglishReportController) SetEnabled() {
 	}
 	item, err := models.GetEnglishReportClassifyById(req.ClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在"
 			return
 		}

+ 3 - 3
controllers/english_report/english_company.go

@@ -266,7 +266,7 @@ func (this *EnglishCompanyController) Save() {
 
 	// 重名校验
 	exist, e := models.GetEnglishCompanyByName(req.CompanyName)
-	if e != nil && e.Error() != utils.ErrNoRow() {
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "保存失败"
 		br.ErrMsg = "获取客户信息失败, Err:" + e.Error()
 		return
@@ -298,7 +298,7 @@ func (this *EnglishCompanyController) Save() {
 			return
 		}
 	} else {
-		if exist != nil && exist.CompanyId != req.CompanyId {
+		if exist != nil && exist.CompanyId != req.CompanyId && exist.CompanyId > 0 {
 			br.Msg = "客户名称已存在"
 			return
 		}
@@ -721,7 +721,7 @@ func (this *EnglishCompanyController) SavePermission() {
 	nowTime := time.Now().Local()
 	item, e := models.GetEnglishCompanyById(req.CompanyId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "客户已被删除, 请刷新页面"
 			return
 		}

+ 2 - 2
controllers/english_report/english_company_todo.go

@@ -2,12 +2,12 @@ package english_report
 
 import (
 	"encoding/json"
-	"github.com/rdlucklib/rdluck_tools/paging"
 	"eta/eta_api/controllers"
 	"eta/eta_api/models"
 	"eta/eta_api/models/system"
 	"eta/eta_api/services"
 	"eta/eta_api/utils"
+	"github.com/rdlucklib/rdluck_tools/paging"
 	"html"
 	"time"
 )
@@ -524,7 +524,7 @@ func (this *EnglishCompanyTodoController) LastPublicTodo() {
 	}
 
 	item, e := models.GetLastEnglishCompanyTodoPublic()
-	if e != nil && e.Error() != utils.ErrNoRow() {
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取最新的公共TODO失败, Err: " + e.Error()
 		return

+ 5 - 5
controllers/english_report/english_video.go

@@ -2,12 +2,12 @@ package english_report
 
 import (
 	"encoding/json"
-	"github.com/rdlucklib/rdluck_tools/paging"
 	"eta/eta_api/controllers"
 	"eta/eta_api/models"
 	"eta/eta_api/models/company"
 	"eta/eta_api/services"
 	"eta/eta_api/utils"
+	"github.com/rdlucklib/rdluck_tools/paging"
 	"strconv"
 	"strings"
 )
@@ -251,7 +251,7 @@ func (this *EnglishVideoController) Detail() {
 	}
 	item, err := models.GetEnglishVideoById(id)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "路演视频不存在"
 			return
 		}
@@ -408,7 +408,7 @@ func (this *EnglishVideoController) PublishVideo() {
 	}
 	videoInfo, err := models.GetEnglishVideoById(id)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "路演视频不存在"
 			return
 		}
@@ -474,7 +474,7 @@ func (this *EnglishVideoController) PublishCancleVideo() {
 	}
 	videoInfo, err := models.GetEnglishVideoById(req.Id)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "路演视频不存在"
 			return
 		}
@@ -526,7 +526,7 @@ func (this *EnglishVideoController) Delete() {
 	}
 	videoInfo, err := models.GetEnglishVideoById(req.Id)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "路演视频不存在"
 			return
 		}

+ 1 - 1
controllers/english_report/policy_report.go

@@ -39,7 +39,7 @@ func (this *EnglishPolicyReportController) Detail() {
 	}
 	item, err := models.GetEnglishPolicyReportById(reportId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "报告不存在!"
 			return
 		}

+ 10 - 10
controllers/english_report/report.go

@@ -94,7 +94,7 @@ func (this *EnglishReportController) Add() {
 	}
 	reportClassify, e := models.GetEnglishReportClassifyById(req.ClassifyIdFirst)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "报告所在分类异常"
 			return
 		}
@@ -250,7 +250,7 @@ func (this *EnglishReportController) Edit() {
 	var stage int
 	report, e := models.GetEnglishReportById(int(req.ReportId))
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "报告已被删除, 请刷新页面"
 			return
 		}
@@ -337,7 +337,7 @@ func (this *EnglishReportController) Detail() {
 	}
 	item, err := models.GetEnglishReportById(reportId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "报告已被删除"
 			return
 		}
@@ -926,7 +926,7 @@ func (this *EnglishReportController) Delete() {
 	}
 	reportInfo, err := models.GetEnglishReportById(req.ReportIds)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "报告不存在"
 			return
 		}
@@ -1071,7 +1071,7 @@ func (this *EnglishReportController) ClassifyIdDetail() {
 		classifyIdSecond, _ = this.GetInt("ClassifyIdSecond")
 	}
 	item, err := models.GetEnglishReportDetailByClassifyId(classifyIdFirst, classifyIdSecond)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败!"
 		br.ErrMsg = "获取失败,Err:" + err.Error()
 		return
@@ -1251,7 +1251,7 @@ func (this *EnglishReportController) EditPolicy() {
 	//查询报告是否存在
 	reportInfo, err := models.GetEnglishReportItemById(int(req.ReportId))
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "报告不存在"
 			return
 		}
@@ -1333,7 +1333,7 @@ func (this *EnglishReportController) SubmitApprove() {
 	reportOb := new(models.EnglishReport)
 	reportItem, e := reportOb.GetItemById(reportId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "报告已被删除, 请刷新页面"
 			return
 		}
@@ -1343,7 +1343,7 @@ func (this *EnglishReportController) SubmitApprove() {
 	}
 	reportClassify, e := models.GetEnglishReportClassifyById(reportItem.ClassifyIdFirst)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "报告所在分类异常"
 			return
 		}
@@ -1434,7 +1434,7 @@ func (this *EnglishReportController) CancelApprove() {
 	reportOb := new(models.EnglishReport)
 	reportItem, e := reportOb.GetItemById(reportId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "报告已被删除, 请刷新页面"
 			return
 		}
@@ -1444,7 +1444,7 @@ func (this *EnglishReportController) CancelApprove() {
 	}
 	reportClassify, e := models.GetEnglishReportClassifyById(reportItem.ClassifyIdFirst)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "报告所在分类异常"
 			return
 		}

+ 1 - 1
controllers/eta_trial/questionnaire.go

@@ -56,7 +56,7 @@ func (this *EtaTrialController) QuestionnairePopUp() {
 	}
 
 	fillItem, e := eta_trial.GetQuestionnaireFillRecordCountByMobile(sysUser.Mobile)
-	if e != nil && e.Error() != utils.ErrNoRow() {
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败失败,GetQuestionnaireFillRecordCountByMobile Err:" + e.Error()
 		return

+ 12 - 10
controllers/hisugar_data.go

@@ -446,7 +446,7 @@ func (c *TradeCommonController) HisugarNameCheck() {
 			EdbName: v.EdbName,
 		})
 		dataItems, err := data_manage.GetEdbDataAllByEdbCode(v.EdbCode, utils.DATA_SOURCE_HISUGAR, 0, utils.EDB_DATA_LIMIT)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取泛糖科技已存在信息失败,Err:" + err.Error()
 			return
@@ -675,11 +675,13 @@ func (this *TradeCommonController) HisugarExporthisugarList() {
 	if req.IsSelectedAll {
 		if len(req.IndexCode) > 0 {
 			condition += ` AND index_code NOT IN (` + utils.GetOrmInReplace(len(req.IndexCode)) + `)`
+			//condition += ` AND index_code NOT IN ? `
 			pars = append(pars, req.IndexCode)
 		}
 	} else {
 		if len(req.IndexCode) > 0 {
 			condition += ` AND index_code IN (` + utils.GetOrmInReplace(len(req.IndexCode)) + `)`
+			//condition += ` AND index_code IN ?`
 			pars = append(pars, req.IndexCode)
 		}
 	}
@@ -690,8 +692,10 @@ func (this *TradeCommonController) HisugarExporthisugarList() {
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
 		}
-		if classifyIds != ""{
-			condition += ` AND classify_id IN (`+ classifyIds +`)`
+		if classifyIds != "" {
+			condition += ` AND classify_id IN (` + classifyIds + `)`
+			//condition += ` AND classify_id IN (?)`
+			//pars = append(pars, classifyIds)
 		}
 	}
 	frequencies, err := data_manage.GetHisugarFrequencyByCondition(condition, pars)
@@ -721,7 +725,7 @@ func (this *TradeCommonController) HisugarExporthisugarList() {
 			return
 		}
 
-		sheetNew, err := xlsxFile.AddSheet(*frequency+frequencyMap[*frequency])
+		sheetNew, err := xlsxFile.AddSheet(*frequency + frequencyMap[*frequency])
 		if err != nil {
 			fmt.Println("新增Sheet失败", err.Error())
 			return
@@ -911,8 +915,8 @@ func (this *TradeCommonController) HisugarIndexData() {
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
 		}
-		if classifyIds != ""{
-			condition += ` AND classify_id IN (`+ classifyIds +`)`
+		if classifyIds != "" {
+			condition += ` AND classify_id IN (` + classifyIds + `)`
 		}
 	}
 
@@ -1058,7 +1062,6 @@ func (this *TradeCommonController) GetHisugarIndexInfo() {
 	br.Data = indexInfoPage
 }
 
-
 // FrequencyList
 // @Title 指标频度列表
 // @Description 指标频度列表
@@ -1092,12 +1095,11 @@ func (this *TradeCommonController) FrequencyList() {
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
 		}
-		if classifyIds != ""{
-			condition += ` AND classify_id IN (`+ classifyIds +`)`
+		if classifyIds != "" {
+			condition += ` AND classify_id IN (` + classifyIds + `)`
 		}
 	}
 
-
 	frequencies, err := data_manage.GetHisugarFrequencyByCondition(condition, pars)
 	if err != nil {
 		fmt.Println("GetSciFrequency err:", err.Error())

+ 16 - 16
controllers/material/material.go

@@ -158,7 +158,7 @@ func (this *MaterialController) EditMaterialClassify() {
 	// 只允许修改分类名称
 	item, err := material.GetMaterialClassifyById(req.ClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在"
 			return
 		}
@@ -404,7 +404,7 @@ func (this *MaterialController) DeleteMaterialClassify() {
 	/*if req.MaterialId > 0 {
 		materialInfo, err := material.GetMaterialById(req.MaterialId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "素材库已删除,请刷新页面"
 				br.ErrMsg = "指标不存在,Err:" + err.Error()
 				return
@@ -466,7 +466,7 @@ func (this *MaterialController) ClassifyMove() {
 	//判断分类是否存在
 	materialClassifyInfo, err := material.GetMaterialClassifyById(req.ClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在,请刷新页面"
 			br.ErrMsg = "分类不存在,Err:" + err.Error()
 			return
@@ -818,7 +818,7 @@ func (this *MaterialController) List() {
 
 	//获取图表信息
 	list, err := material.GetMaterialListPageByCondition(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Success = true
 		br.Msg = "获取素材库信息失败"
 		br.ErrMsg = "获取素材库信息失败,Err:" + err.Error()
@@ -826,7 +826,7 @@ func (this *MaterialController) List() {
 	}
 
 	resp := new(material.MaterialListResp)
-	if list == nil || len(list) <= 0 || (err != nil && err.Error() == utils.ErrNoRow()) {
+	if list == nil || len(list) <= 0 || (err != nil && utils.IsErrNoRow(err)) {
 		items := make([]*material.MaterialListItems, 0)
 		resp.Paging = page
 		resp.List = items
@@ -838,7 +838,7 @@ func (this *MaterialController) List() {
 	}
 
 	dataCount, err := material.GetMaterialListCountByCondition(condition, pars)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取指标信息失败"
 		br.ErrMsg = "获取指标数据总数失败,Err:" + err.Error()
 		return
@@ -891,7 +891,7 @@ func (this *MaterialController) SaveAsMaterial() {
 		// 判断名称是否重复
 		exist, err = material.GetMaterialByName(req.MaterialName)
 	}
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -1206,14 +1206,14 @@ func (this *MaterialController) MaterialClassifyList() {
 	resp := new(material.MaterialClassifyListResp)
 
 	rootList, err := material.GetMaterialClassifyByParentId(0)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
 
 	classifyAll, err := material.GetMaterialClassifyAll()
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
@@ -1475,7 +1475,7 @@ func (this *MaterialController) BatchChangeClassify() {
 	// 判断新分类是否存在
 	_, err = material.GetMaterialClassifyById(req.NewClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在"
 			return
 		}
@@ -1534,7 +1534,7 @@ func (this *MaterialController) ChangeClassify() {
 	// 判断素材是否存在
 	info, err := material.GetMaterialById(req.MaterialId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "素材不存在"
 			return
 		}
@@ -1551,7 +1551,7 @@ func (this *MaterialController) ChangeClassify() {
 	// 判断新分类是否存在
 	_, err = material.GetMaterialClassifyById(req.NewClassifyId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "分类不存在"
 			return
 		}
@@ -1613,7 +1613,7 @@ func (this *MaterialController) Rename() {
 	// 判断素材是否存在
 	info, err := material.GetMaterialById(req.MaterialId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "素材不存在"
 			return
 		}
@@ -1643,12 +1643,12 @@ func (this *MaterialController) Rename() {
 		info.MaterialName = req.MaterialName
 		updateStr = append(updateStr, "MaterialName")
 	}
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
-	if err == nil && exist.MaterialId > 0 {
+	if err == nil && exist != nil && exist.MaterialId > 0 {
 		br.Msg = "图片名称已存在"
 		return
 	}
@@ -1844,7 +1844,7 @@ func (this *MaterialController) Download() {
 	// 判断素材是否存在
 	info, err := material.GetMaterialById(materialId)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "素材不存在"
 			return
 		}

+ 2 - 5
controllers/meeting_probabilities.go

@@ -43,7 +43,7 @@ func (c *MeetingProbabilitiesController) Detail() {
 	// 获取数据详情bu
 	excelDetail, err := models.GetMeetingInfoById(date)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Ret = 200
 			br.Msg = "该日期无数据"
 			br.Msg = "该日期无数据,Err:" + err.Error()
@@ -57,11 +57,10 @@ func (c *MeetingProbabilitiesController) Detail() {
 		sheet := new(request.ISheet)
 		err = json.Unmarshal([]byte(excelDetail.Content), &sheet)
 
-		MeetingProbabilitiesExport(c,br,sheet)
+		MeetingProbabilitiesExport(c, br, sheet)
 		return
 	}
 
-
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"
@@ -87,7 +86,6 @@ func MeetingProbabilitiesExport(this *MeetingProbabilitiesController, br *models
 		return
 	}
 
-
 	for _, v := range sheetReq.Data {
 		addRow := sheet.AddRow()
 		for _, s := range v {
@@ -111,4 +109,3 @@ func MeetingProbabilitiesExport(this *MeetingProbabilitiesController, br *models
 	br.Success = true
 	br.Msg = "success"
 }
-

+ 7 - 8
controllers/oilchem_data.go

@@ -103,7 +103,7 @@ func (this *TradeCommonController) OilchemIndexList() {
 		for _, v1 := range dataList {
 			if v.BaseFromOilchemIndexId == v1.BaseFromOilchemIndexId {
 				indexList[i].DataTime = v1.DataTime
-				indexList[i].Value = v1.Value
+				indexList[i].Value = v1.Value.String()
 			}
 		}
 	}
@@ -169,7 +169,6 @@ func (this *TradeCommonController) OilchemData() {
 	condition += ` AND index_code =? `
 	pars = append(pars, indexCode)
 
-
 	index, err := data_manage.GetOilchemIndexByCode(indexCode)
 	if err != nil {
 		br.Msg = "获取数据失败"
@@ -186,7 +185,6 @@ func (this *TradeCommonController) OilchemData() {
 
 	resp := data_manage.BaseFromOilchemIndexList{}
 
-
 	resp.BaseFromOilchemIndexId = index.BaseFromOilchemIndexId
 	resp.ClassifyId = index.ClassifyId
 	resp.IndexCode = index.IndexCode
@@ -198,7 +196,6 @@ func (this *TradeCommonController) OilchemData() {
 	total, err := data_manage.GetOilchemDataListCount(condition, pars)
 	page := paging.GetPaging(currentIndex, pageSize, total)
 
-
 	if len(dataList) > 0 {
 		resp.ModifyTime = dataList[0].ModifyTime
 	}
@@ -444,7 +441,7 @@ func (c *TradeCommonController) NameCheck() {
 			EdbName: v.EdbName,
 		})
 		dataItems, err := data_manage.GetEdbDataAllByEdbCode(v.EdbCode, utils.DATA_SOURCE_OILCHEM, 0, utils.EDB_DATA_LIMIT)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取隆众资讯已存在信息失败,Err:" + err.Error()
 			return
@@ -672,12 +669,14 @@ func (this *TradeCommonController) ExportoilchemList() {
 	}
 	if req.IsSelectedAll {
 		if len(req.IndexCode) > 0 {
-			condition += ` AND index_code NOT IN (` + utils.GetOrmInReplace(len(req.IndexCode)) + `)`
+			//condition += ` AND index_code NOT IN (` + utils.GetOrmInReplace(len(req.IndexCode)) + `)`
+			condition += ` AND index_code NOT IN ?`
 			pars = append(pars, req.IndexCode)
 		}
 	} else {
 		if len(req.IndexCode) > 0 {
-			condition += ` AND index_code IN (` + utils.GetOrmInReplace(len(req.IndexCode)) + `)`
+			//condition += ` AND index_code IN (` + utils.GetOrmInReplace(len(req.IndexCode)) + `)`
+			condition += ` AND index_code IN ?`
 			pars = append(pars, req.IndexCode)
 		}
 	}
@@ -810,4 +809,4 @@ func (this *TradeCommonController) ExportoilchemList() {
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "success"
-}
+}

+ 2 - 2
controllers/out_link.go

@@ -120,7 +120,7 @@ func (ol *OutLinkController) Del() {
 	// 查询
 	err := outLink.GetItemById(req.Id)
 	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(err) {
 			br.Msg = "该记录已被删除, 请刷新页面"
 			return
 		}
@@ -252,7 +252,7 @@ func (ol *OutLinkController) AllList() {
 	resp := &models.OutLinkListResp{
 		List: respList,
 	}
-	
+
 	if ol.SysUser.AdminName != "" {
 		desEncrypt := utils.DesBase64Encrypt([]byte(ol.SysUser.AdminName), utils.DesKeySalt)
 		resp.UserCode = string(desEncrypt)

+ 10 - 10
controllers/ppt_english.go

@@ -136,12 +136,12 @@ func (this *PptEnglishController) AddPpt() {
 			return
 		}
 		item, err := ppt_english.GetPptEnglishByTitleAndId(req.FirstPage.Title, this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取数据异常!"
 			br.ErrMsg = "获取数据异常,Err:" + err.Error()
 			return
 		}
-		if item != nil {
+		if item != nil && item.PptId > 0 {
 			br.Msg = "标题已存在,不可重复添加"
 			br.IsSendEmail = false
 			return
@@ -260,12 +260,12 @@ func (this *PptEnglishController) EditPpt() {
 		return
 	}
 	item, err := ppt_english.GetPptEnglishByTitleAndId(req.FirstPage.Title, this.SysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取数据异常!"
 		br.ErrMsg = "获取数据异常,Err:" + err.Error()
 		return
 	}
-	if item != nil && item.PptId != int(req.PptId) {
+	if item != nil && item.PptId != int(req.PptId) && item.PptId > 0 {
 		br.Msg = "标题已存在,不可重复添加"
 		br.IsSendEmail = false
 		return
@@ -281,7 +281,7 @@ func (this *PptEnglishController) EditPpt() {
 	if pptInfo.AdminId != this.SysUser.AdminId {
 		_, err := ppt_english.GetPPtGrantConf(pptInfo.PptId, this.SysUser.AdminId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = `该PPT已取消共享,保存失败`
 				br.ErrMsg = `该PPT已取消共享,保存失败`
 				br.IsSendEmail = false
@@ -709,12 +709,12 @@ func (this *PptEnglishController) SaveLog() {
 
 	// 获取ppt
 	item, err := ppt_english.GetPptEnglishByTitleAndId(req.FirstPage.Title, this.SysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取数据异常!"
 		br.ErrMsg = "获取数据异常,Err:" + err.Error()
 		return
 	}
-	if item != nil && item.PptId != int(req.PptId) {
+	if item != nil && item.PptId != int(req.PptId) && item.PptId > 0 {
 		br.Msg = "标题已存在,不可重复添加"
 		br.IsSendEmail = false
 		return
@@ -723,7 +723,7 @@ func (this *PptEnglishController) SaveLog() {
 	//变更ppt内容
 	pptItem, e := ppt_english.GetPptEnglishById(int(req.PptId))
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "PPT已被删除, 请刷新页面"
 			return
 		}
@@ -1081,12 +1081,12 @@ func (this *PptEnglishController) TitleCheck() {
 		return
 	}
 	item, err := ppt_english.GetPptEnglishByTitleAndId(title, this.SysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取数据异常!"
 		br.ErrMsg = "获取数据异常,Err:" + err.Error()
 		return
 	}
-	if item != nil && item.PptId != pptId {
+	if item != nil && item.PptId != pptId && item.PptId > 0 {
 		br.Msg = "标题已存在,不可重复添加"
 		br.IsSendEmail = false
 		return

+ 18 - 13
controllers/ppt_v2.go

@@ -136,12 +136,12 @@ func (this *PptV2Controller) AddPpt() {
 			return
 		}
 		item, err := models.GetPptV2ByTitleAndId(req.FirstPage.Title, this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取数据异常!"
 			br.ErrMsg = "获取数据异常,Err:" + err.Error()
 			return
 		}
-		if item != nil && item.PptId != int(req.PptId) {
+		if item != nil && item.PptId != int(req.PptId) && item.PptId > 0 {
 			br.Msg = "标题已存在,不可重复添加"
 			br.IsSendEmail = false
 			return
@@ -260,12 +260,12 @@ func (this *PptV2Controller) EditPpt() {
 		return
 	}
 	item, err := models.GetPptV2ByTitleAndId(req.FirstPage.Title, this.SysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取数据异常!"
 		br.ErrMsg = "获取数据异常,Err:" + err.Error()
 		return
 	}
-	if item != nil && item.PptId != int(req.PptId) {
+	if item != nil && item.PptId != int(req.PptId) && item.PptId > 0 {
 		br.Msg = "标题已存在,不可重复添加"
 		br.IsSendEmail = false
 		return
@@ -281,7 +281,7 @@ func (this *PptV2Controller) EditPpt() {
 	if pptInfo.AdminId != this.SysUser.AdminId {
 		_, err := models.GetPPtGrantConf(pptInfo.PptId, this.SysUser.AdminId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = `该PPT已取消共享,保存失败`
 				br.ErrMsg = `该PPT已取消共享,保存失败`
 				br.IsSendEmail = false
@@ -678,12 +678,12 @@ func (this *PptV2Controller) SaveLog() {
 
 	// 获取ppt
 	item, err := models.GetPptV2ByTitleAndId(req.FirstPage.Title, this.SysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取数据异常!"
 		br.ErrMsg = "获取数据异常,Err:" + err.Error()
 		return
 	}
-	if item != nil && item.PptId != int(req.PptId) {
+	if item != nil && item.PptId != int(req.PptId) && item.PptId > 0 {
 		br.Msg = "标题已存在,不可重复添加"
 		br.IsSendEmail = false
 		return
@@ -692,7 +692,7 @@ func (this *PptV2Controller) SaveLog() {
 	//变更ppt内容
 	pptItem, e := models.GetPptV2ById(int(req.PptId))
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "PPT已被删除, 请刷新页面"
 			return
 		}
@@ -724,9 +724,14 @@ func (this *PptV2Controller) SaveLog() {
 	// 将更新后的PPT, 置顶
 	pptMap, err := models.GetPptMappingByPptId(int64(req.PptId))
 	if err != nil {
-		br.Msg = `该PPT信息不存在, 保存失败`
-		br.ErrMsg = `该PPT信息不存在, 保存失败, Err` + err.Error()
-		br.IsSendEmail = false
+		if utils.IsErrNoRow(err) {
+			br.Msg = `该PPT信息不存在, 保存失败`
+			br.ErrMsg = `该PPT信息不存在, 保存失败, Err` + err.Error()
+			br.IsSendEmail = false
+			return
+		}
+		br.Msg = "保存草稿失败"
+		br.ErrMsg = fmt.Sprintf("保存草稿失败, %v", err)
 		return
 	}
 	pptMapList, err := models.GetPptMappingListByGroupId(pptMap.GroupId)
@@ -1258,12 +1263,12 @@ func (this *PptV2Controller) TitleCheck() {
 		return
 	}
 	item, err := models.GetPptV2ByTitleAndId(title, this.SysUser.AdminId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取数据异常!"
 		br.ErrMsg = "获取数据异常,Err:" + err.Error()
 		return
 	}
-	if item != nil && item.PptId != pptId {
+	if item != nil && item.PptId != pptId && item.PptId > 0 {
 		br.Msg = "标题已存在,不可重复添加"
 		br.IsSendEmail = false
 		return

+ 3 - 3
controllers/report.go

@@ -379,7 +379,7 @@ func (this *ReportController) ClassifyIdDetail() {
 		classifyIdSecond, _ = this.GetInt("ClassifyIdSecond")
 	}
 	item, err := models.GetReportDetailByClassifyId(classifyIdFirst, classifyIdSecond)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败!"
 		br.ErrMsg = "获取失败,Err:" + err.Error()
 		return
@@ -852,7 +852,7 @@ func (this *ReportController) ThsSendTemplateMsg() {
 
 		report, err := models.GetReportById(v)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(err) {
 				br.Msg = "报告已经被删除,请刷新页面"
 				br.ErrMsg = "报告已经被删除,请刷新页面,req:" + string(this.Ctx.Input.RequestBody)
 				return
@@ -1457,7 +1457,7 @@ func (this *ReportController) GetLastDayWeekReportChapter() {
 	typeId, _ := this.GetInt("TypeId")
 	reportType := this.GetString("ReportType")
 	item, err := models.GetLastPublishedReportChapter(typeId, reportType)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil && !utils.IsErrNoRow(err) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取上一篇晨周报失败, Err: " + err.Error()
 		return

+ 36 - 35
controllers/report_approve/report_approve.go

@@ -483,15 +483,15 @@ func (this *ReportApproveController) Detail() {
 
 	approveOb := new(report_approve.ReportApprove)
 	approveItem, e := approveOb.GetItemById(approveId)
-	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
-			br.Msg = "审批已被删除, 请刷新页面"
-			return
-		}
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取审批失败, Err: " + e.Error()
 		return
 	}
+	if approveItem != nil && approveItem.ReportApproveId <= 0 {
+		br.Msg = "审批已被删除, 请刷新页面"
+		return
+	}
 
 	// 审批信息
 	detail := new(report_approve.ReportApproveDetail)
@@ -717,15 +717,15 @@ func (this *ReportApproveController) Approve() {
 
 	approveOb := new(report_approve.ReportApprove)
 	approveItem, e := approveOb.GetItemById(req.ReportApproveId)
-	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
-			br.Msg = "审批不存在, 请刷新页面"
-			return
-		}
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "操作失败"
 		br.ErrMsg = "获取审批信息失败, Err: " + e.Error()
 		return
 	}
+	if approveItem != nil && approveItem.ReportApproveId <= 0 {
+		br.Msg = "审批不存在, 请刷新页面"
+		return
+	}
 	if approveItem.State != report_approve.ReportApproveStateApproving {
 		br.Msg = "审批状态有误, 请刷新页面"
 		br.ErrMsg = fmt.Sprintf("审批状态有误, State: %d", approveItem.State)
@@ -738,15 +738,15 @@ func (this *ReportApproveController) Approve() {
 	recordPars := make([]interface{}, 0)
 	recordPars = append(recordPars, approveItem.ReportApproveId, sysUser.AdminId, report_approve.ReportApproveStateApproving)
 	recordItem, e := recordOb.GetItemByCondition(recordCond, recordPars, "")
-	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
-			br.Msg = "无权审批"
-			return
-		}
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "操作失败"
 		br.ErrMsg = "获取审批记录失败, Err: " + e.Error()
 		return
 	}
+	if recordItem != nil && recordItem.ReportApproveRecordId <= 0 {
+		br.Msg = "审批记录有误"
+		return
+	}
 
 	// 通过审批
 	tips, e := services.PassReportApprove(approveItem, recordItem, sysUser.AdminId, req.ReportUrl)
@@ -801,15 +801,15 @@ func (this *ReportApproveController) Refuse() {
 
 	approveOb := new(report_approve.ReportApprove)
 	approveItem, e := approveOb.GetItemById(req.ReportApproveId)
-	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
-			br.Msg = "审批不存在, 请刷新页面"
-			return
-		}
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "操作失败"
 		br.ErrMsg = "获取审批信息失败, Err: " + e.Error()
 		return
 	}
+	if approveItem != nil && approveItem.ReportApproveId <= 0 {
+		br.Msg = "审批不存在, 请刷新页面"
+		return
+	}
 	if approveItem.State != report_approve.ReportApproveStateApproving {
 		br.Msg = "审批状态有误, 请刷新页面"
 		br.ErrMsg = fmt.Sprintf("审批状态有误, State: %d", approveItem.State)
@@ -822,15 +822,15 @@ func (this *ReportApproveController) Refuse() {
 	recordPars := make([]interface{}, 0)
 	recordPars = append(recordPars, approveItem.ReportApproveId, sysUser.AdminId, report_approve.ReportApproveStateApproving)
 	recordItem, e := recordOb.GetItemByCondition(recordCond, recordPars, "")
-	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
-			br.Msg = "无权审批"
-			return
-		}
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "操作失败"
 		br.ErrMsg = "获取审批记录失败, Err: " + e.Error()
 		return
 	}
+	if recordItem != nil && recordItem.ReportApproveRecordId <= 0 {
+		br.Msg = "审批记录有误"
+		return
+	}
 
 	// 驳回审批
 	if e = services.RefuseReportApprove(approveItem, recordItem, req.ApproveRemark, sysUser.AdminId); e != nil {
@@ -880,15 +880,15 @@ func (this *ReportApproveController) Cancel() {
 
 	approveOb := new(report_approve.ReportApprove)
 	approveItem, e := approveOb.GetItemById(req.ReportApproveId)
-	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
-			br.Msg = "审批已被删除, 请刷新页面"
-			return
-		}
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "操作失败"
 		br.ErrMsg = "获取审批失败, Err: " + e.Error()
 		return
 	}
+	if approveItem != nil && approveItem.ReportApproveId <= 0 {
+		br.Msg = "审批已被删除, 请刷新页面"
+		return
+	}
 	if approveItem.ApplyUserId != sysUser.AdminId {
 		br.Msg = "非申请人不可撤销"
 		return
@@ -1027,15 +1027,16 @@ func (this *ReportApproveController) MessageRead() {
 
 	messageOb := new(report_approve.ReportApproveMessage)
 	messageItem, e := messageOb.GetItemById(req.MessageId)
-	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
-			br.Msg = "消息不存在, 请刷新页面"
-			return
-		}
+	if e != nil && !utils.IsErrNoRow(e) {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取审批消息失败, Err: " + e.Error()
 		return
 	}
+	if messageItem != nil && messageItem.Id <= 0 {
+		br.Msg = "消息不存在, 请刷新页面"
+		return
+	}
+
 	messageItem.IsRead = 1
 	messageItem.ModifyTime = time.Now().Local()
 	cols := []string{"IsRead", "ModifyTime"}

+ 8 - 8
controllers/report_approve/report_approve_flow.go

@@ -266,12 +266,12 @@ func (this *ReportApproveFlowController) Add() {
 		existPars := make([]interface{}, 0)
 		existPars = append(existPars, req.ReportType, req.ClassifyFirstId, req.ClassifySecondId, req.ClassifyThirdId)
 		exist, e := flowOb.GetItemByCondition(existCond, existPars, "")
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取审批流是否已存在失败, Err: " + e.Error()
 			return
 		}
-		if exist != nil {
+		if exist != nil && exist.ReportApproveFlowId > 0 {
 			br.Msg = "该分类已有审批流, 请勿重复添加"
 			return
 		}
@@ -401,7 +401,7 @@ func (this *ReportApproveFlowController) Edit() {
 	flowOb := new(report_approve.ReportApproveFlow)
 	flowItem, e := flowOb.GetItemById(req.ReportApproveFlowId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "审批流已被删除, 请刷新页面"
 			return
 		}
@@ -416,12 +416,12 @@ func (this *ReportApproveFlowController) Edit() {
 		existPars := make([]interface{}, 0)
 		existPars = append(existPars, req.ReportType, req.ClassifyFirstId, req.ClassifySecondId, req.ClassifyThirdId, req.ReportApproveFlowId)
 		exist, e := flowOb.GetItemByCondition(existCond, existPars, "")
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "操作失败"
 			br.ErrMsg = "获取审批流是否已存在失败, Err: " + e.Error()
 			return
 		}
-		if exist != nil {
+		if exist != nil && exist.ReportApproveFlowId > 0 {
 			br.Msg = "该分类已有审批流, 请勿重复添加"
 			return
 		}
@@ -530,7 +530,7 @@ func (this *ReportApproveFlowController) Detail() {
 	flowOb := new(report_approve.ReportApproveFlow)
 	flowItem, e := flowOb.GetItemById(flowId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "审批流已被删除, 请刷新页面"
 			return
 		}
@@ -600,7 +600,7 @@ func (this *ReportApproveFlowController) Remove() {
 	flowOb := new(report_approve.ReportApproveFlow)
 	flowItem, e := flowOb.GetItemById(req.ReportApproveFlowId)
 	if e != nil {
-		if e.Error() == utils.ErrNoRow() {
+		if utils.IsErrNoRow(e) {
 			br.Msg = "审批流已被删除, 请刷新页面"
 			return
 		}
@@ -668,7 +668,7 @@ func (this *ReportApproveFlowController) ReportClassifyTree() {
 		flowOb := new(report_approve.ReportApproveFlow)
 		flowItem, e := flowOb.GetItemById(flowId)
 		if e != nil {
-			if e.Error() == utils.ErrNoRow() {
+			if utils.IsErrNoRow(e) {
 				br.Msg = "审批流已被删除, 请刷新页面"
 				return
 			}

部分文件因为文件数量过多而无法显示