ソースを参照

Merge branch 'feature/source_hide_430'

hsun 1 日 前
コミット
2ad9d18735
4 ファイル変更85 行追加42 行削除
  1. 13 11
      controllers/sys_role.go
  2. 16 15
      models/business_conf.go
  3. 36 16
      services/data/chart_info.go
  4. 20 0
      services/data/excel/excel_info.go

+ 13 - 11
controllers/sys_role.go

@@ -726,17 +726,19 @@ func (this *SysRoleController) SystemConfig() {
 	}, system.BusinessConf{
 		ConfKey: "LoginUrl",
 		ConfVal: conf["LoginUrl"],
-	},
-		system.BusinessConf{
-			ConfKey: "KnowledgeBaseName",
-			ConfVal: conf["KnowledgeBaseName"],
-		}, system.BusinessConf{
-			ConfKey: "NotBackendGenerate",
-			ConfVal: conf["NotBackendGenerate"],
-		}, system.BusinessConf{
-			ConfKey: models.KnowledgeBaseName,
-			ConfVal: conf[models.KnowledgeBaseName],
-		})
+	}, system.BusinessConf{
+		ConfKey: "KnowledgeBaseName",
+		ConfVal: conf["KnowledgeBaseName"],
+	}, system.BusinessConf{
+		ConfKey: "NotBackendGenerate",
+		ConfVal: conf["NotBackendGenerate"],
+	}, system.BusinessConf{
+		ConfKey: models.KnowledgeBaseName,
+		ConfVal: conf[models.KnowledgeBaseName],
+	}, system.BusinessConf{
+		ConfKey: models.BusinessConfHideSourceFormSMM,
+		ConfVal: conf[models.BusinessConfHideSourceFormSMM],
+	})
 
 	osc := system.BusinessConf{
 		ConfKey: "ObjectStorageClient",

+ 16 - 15
models/business_conf.go

@@ -61,21 +61,22 @@ const (
 	BusinessConfEsIndexNameDataSource        = "EsIndexNameDataSource"        // ES索引名称-数据源
 
 	// DongWu SMS configuration
-	BusinessConfDongwuSmsAppKey    = "DongWuSmsAppKey"    // 东吴短信AppKey
-	BusinessConfDongwuSmsApiUrl    = "DongWuSmsApiUrl"    // 东吴短信API地址
-
-	LLMInitConfig                            = "llmInitConfig"
-	KnowledgeBaseName                        = "KnowledgeBaseName"                // 摘要库
-	PrivateKnowledgeBaseName                 = "PrivateKnowledgeBaseName"         // 私有摘要库
-	KnowledgeArticleName                     = "KnowledgeArticleName"             // 原文库
-	BusinessConfEsWechatArticle              = "EsIndexNameWechatArticle"         // ES索引名称-微信文章
-	BusinessConfEsWechatArticleAbstract      = "EsIndexNameWechatArticleAbstract" // ES索引名称-微信文章摘要
-	BusinessConfEsRagQuestion                = "EsIndexNameRagQuestion"           // ES索引名称-知识库问题
-	BusinessConfEsRagEtaReportAbstract       = "EsIndexNameRagEtaReportAbstract"  // ES索引名称-eta报告摘要
-	BusinessConfIsOpenChartExpired           = "IsOpenChartExpired"               // 是否开启图表有效期鉴权/报告禁止复制
-	BusinessConfReportChartExpiredTime       = "ReportChartExpiredTime"           // 图表有效期鉴权时间,单位:分钟
-	BusinessConfOssUrlReplace                = "OssUrlReplace"                    // OSS地址替换-兼容内网客户用
-	BusinessConfLoginPictureVerifyCode       = "IsLoginPictureVerifyCode"               // OSS地址替换-兼容内网客户用
+	BusinessConfDongwuSmsAppKey = "DongWuSmsAppKey" // 东吴短信AppKey
+	BusinessConfDongwuSmsApiUrl = "DongWuSmsApiUrl" // 东吴短信API地址
+
+	LLMInitConfig                       = "llmInitConfig"
+	KnowledgeBaseName                   = "KnowledgeBaseName"                // 摘要库
+	PrivateKnowledgeBaseName            = "PrivateKnowledgeBaseName"         // 私有摘要库
+	KnowledgeArticleName                = "KnowledgeArticleName"             // 原文库
+	BusinessConfEsWechatArticle         = "EsIndexNameWechatArticle"         // ES索引名称-微信文章
+	BusinessConfEsWechatArticleAbstract = "EsIndexNameWechatArticleAbstract" // ES索引名称-微信文章摘要
+	BusinessConfEsRagQuestion           = "EsIndexNameRagQuestion"           // ES索引名称-知识库问题
+	BusinessConfEsRagEtaReportAbstract  = "EsIndexNameRagEtaReportAbstract"  // ES索引名称-eta报告摘要
+	BusinessConfIsOpenChartExpired      = "IsOpenChartExpired"               // 是否开启图表有效期鉴权/报告禁止复制
+	BusinessConfReportChartExpiredTime  = "ReportChartExpiredTime"           // 图表有效期鉴权时间,单位:分钟
+	BusinessConfOssUrlReplace           = "OssUrlReplace"                    // OSS地址替换-兼容内网客户用
+	BusinessConfLoginPictureVerifyCode  = "IsLoginPictureVerifyCode"         // OSS地址替换-兼容内网客户用
+	BusinessConfHideSourceFormSMM       = "HideSourceFormSMM"                // (弘则专用)是否隐藏SMM/彭博/彭博财务
 )
 
 const (

+ 36 - 16
services/data/chart_info.go

@@ -960,7 +960,7 @@ func GetSeasonEdbInfoDataListByXDate(dataList []*data_manage.EdbDataList, latest
 	//根据数据确定最早的年份,和最近年份
 	//根据横轴的日期,汇总所有的年份
 	startDate := dataList[0].DataTime
-	startDateT, tmpErr := time.ParseInLocation(utils.FormatDate, startDate,time.Local)
+	startDateT, tmpErr := time.ParseInLocation(utils.FormatDate, startDate, time.Local)
 	if tmpErr != nil {
 		err = tmpErr
 		return
@@ -968,7 +968,7 @@ func GetSeasonEdbInfoDataListByXDate(dataList []*data_manage.EdbDataList, latest
 	startYear := startDateT.Year()
 	//获取数据的最新日期
 	lastDate := dataList[length-1].DataTime
-	lastDateT, tmpErr := time.ParseInLocation(utils.FormatDate, lastDate,time.Local)
+	lastDateT, tmpErr := time.ParseInLocation(utils.FormatDate, lastDate, time.Local)
 	if tmpErr != nil {
 		err = tmpErr
 		return
@@ -994,13 +994,13 @@ func GetSeasonEdbInfoDataListByXDate(dataList []*data_manage.EdbDataList, latest
 		name := fmt.Sprintf("%s_%s", startStr, endStr)
 		showName := fmt.Sprintf("%d_%d", currentStartYear, currentEndYear)
 
-		startT, tEr := time.ParseInLocation(utils.FormatDate, startStr,time.Local)
+		startT, tEr := time.ParseInLocation(utils.FormatDate, startStr, time.Local)
 		if tEr != nil {
 			err = tEr
 			return
 		}
 
-		endT, tEr := time.ParseInLocation(utils.FormatDate, endStr,time.Local)
+		endT, tEr := time.ParseInLocation(utils.FormatDate, endStr, time.Local)
 		if tEr != nil {
 			err = tEr
 			return
@@ -1046,7 +1046,7 @@ func GetSeasonEdbInfoDataListByXDate(dataList []*data_manage.EdbDataList, latest
 	}
 
 	for _, v := range dataList {
-		dataTimeT, _ := time.ParseInLocation(utils.FormatDate, v.DataTime,time.Local)
+		dataTimeT, _ := time.ParseInLocation(utils.FormatDate, v.DataTime, time.Local)
 		year := dataTimeT.Year()
 		newItemDate := dataTimeT.AddDate(nowYear-year, 0, 0)
 		for k, dateItem := range dataMap {
@@ -1061,7 +1061,7 @@ func GetSeasonEdbInfoDataListByXDate(dataList []*data_manage.EdbDataList, latest
 				if jumpYear == 1 {
 					//计算前一年最大的日期, 只补齐数据到去年
 					beforeYearMaxDate := fmt.Sprintf("%d-12-31", dateItem.StartDate.Year())
-					beforeYearMaxDateT, _ := time.ParseInLocation(utils.FormatDate, beforeYearMaxDate,time.Local)
+					beforeYearMaxDateT, _ := time.ParseInLocation(utils.FormatDate, beforeYearMaxDate, time.Local)
 					if dataTimeT.Before(beforeYearMaxDateT) || dataTimeT == beforeYearMaxDateT {
 						newItemDate = dataTimeT.AddDate(nowYear-year-1, 0, 0)
 					} else {
@@ -1169,7 +1169,7 @@ func GetSeasonEdbInfoDataListByXDateNong(result *data_manage.EdbDataResult, late
 	//获取数据的最新日期
 	lastDate := result.List[length-1].Items[itemLength-1].DataTime
 	maxY := result.List[length-1].Year
-	lastDateT, tmpErr := time.ParseInLocation(utils.FormatDate, lastDate,time.Local)
+	lastDateT, tmpErr := time.ParseInLocation(utils.FormatDate, lastDate, time.Local)
 	if tmpErr != nil {
 		err = tmpErr
 		return
@@ -1196,13 +1196,13 @@ func GetSeasonEdbInfoDataListByXDateNong(result *data_manage.EdbDataResult, late
 		endStr := fmt.Sprintf("%d-%s", currentEndYear, xEndDate)
 		showName := fmt.Sprintf("%d_%d", currentStartYear, currentEndYear)
 
-		startT, tEr := time.ParseInLocation(utils.FormatDate, startStr,time.Local)
+		startT, tEr := time.ParseInLocation(utils.FormatDate, startStr, time.Local)
 		if tEr != nil {
 			err = tEr
 			return
 		}
 
-		endT, tEr := time.ParseInLocation(utils.FormatDate, endStr,time.Local)
+		endT, tEr := time.ParseInLocation(utils.FormatDate, endStr, time.Local)
 		if tEr != nil {
 			err = tEr
 			return
@@ -1295,7 +1295,7 @@ func GetSeasonEdbInfoDataListByXDateNong(result *data_manage.EdbDataResult, late
 				DataTimestamp: item.DataTimestamp,
 				Value:         item.Value,
 			}
-			dataTimeT, _ := time.ParseInLocation(utils.FormatDate, item.DataTime,time.Local)
+			dataTimeT, _ := time.ParseInLocation(utils.FormatDate, item.DataTime, time.Local)
 			// year := dataTimeT.Year()
 			// newItemDate := dataTimeT.AddDate(nowYear-year, 0, 0)
 			// timestamp := newItemDate.UnixNano() / 1e6
@@ -3094,6 +3094,26 @@ func GetEdbSourceByEdbInfoIdList(chartEdbInfoMappingList []*data_manage.ChartEdb
 		sourceNameList = append(sourceNameList, conf[models.BusinessConfCompanyName])
 		sourceNameEnList = append(sourceNameEnList, conf[models.BusinessConfCompanyName])
 	}
+
+	// (弘则)合规上的要求过滤掉SMM,彭博以及彭博财务;前端那边没办法完全处理掉入口的所以这边也过滤一下
+	if conf[models.BusinessConfHideSourceFormSMM] == "true" {
+		newNames, newEnNames := make([]string, 0), make([]string, 0)
+		for _, v := range sourceNameList {
+			str := strings.ToUpper(v)
+			if str == "SMM" || str == "彭博" || str == "彭博财务" {
+				continue
+			}
+			newNames = append(newNames, v)
+		}
+		for _, v := range sourceNameEnList {
+			str := strings.ToUpper(v)
+			if str == "SMM" || str == "彭博" || str == "彭博财务" {
+				continue
+			}
+			newEnNames = append(newEnNames, v)
+		}
+		return newNames, newEnNames
+	}
 	return
 }
 
@@ -3947,7 +3967,7 @@ func SeasonChartData(dataList []*data_manage.ChartEdbInfoMapping, seasonExtraCon
 				err = e
 				return
 			}
-			endDate, e := time.ParseInLocation(utils.FormatDate, endDateStr,time.Local)
+			endDate, e := time.ParseInLocation(utils.FormatDate, endDateStr, time.Local)
 			if e != nil {
 				err = e
 				return
@@ -3971,7 +3991,7 @@ func SeasonChartData(dataList []*data_manage.ChartEdbInfoMapping, seasonExtraCon
 						continue
 					}
 					for _, date := range dataTimeList {
-						dateTime, e := time.ParseInLocation(utils.FormatDate, date,time.Local)
+						dateTime, e := time.ParseInLocation(utils.FormatDate, date, time.Local)
 						if e != nil {
 							err = errors.New("时间格式化异常, Err:" + e.Error())
 							return
@@ -4087,7 +4107,7 @@ func SeasonChartData(dataList []*data_manage.ChartEdbInfoMapping, seasonExtraCon
 				} else {
 					// 旬度、月度、季度、半年度 不插值,需要先把日期列表和数据map取出来
 					for _, vv := range v.DataList {
-						dateTime, e := time.ParseInLocation(utils.FormatDate, vv.DataTime,time.Local)
+						dateTime, e := time.ParseInLocation(utils.FormatDate, vv.DataTime, time.Local)
 						if e != nil {
 							err = errors.New("时间格式化异常, Err:" + e.Error())
 							return
@@ -4265,7 +4285,7 @@ func SeasonChartData(dataList []*data_manage.ChartEdbInfoMapping, seasonExtraCon
 					return
 				}
 				for _, date := range dataTimeList {
-					dateTime, e := time.ParseInLocation(utils.FormatDate, date,time.Local)
+					dateTime, e := time.ParseInLocation(utils.FormatDate, date, time.Local)
 					if e != nil {
 						err = errors.New("时间格式化异常, Err:" + e.Error())
 						return
@@ -4354,7 +4374,7 @@ func SeasonChartData(dataList []*data_manage.ChartEdbInfoMapping, seasonExtraCon
 					return
 				}
 				for _, date := range dataTimeList {
-					dateTime, e := time.ParseInLocation(utils.FormatDate, date,time.Local)
+					dateTime, e := time.ParseInLocation(utils.FormatDate, date, time.Local)
 					if e != nil {
 						err = errors.New("时间格式化异常, Err:" + e.Error())
 						return
@@ -4426,7 +4446,7 @@ func SeasonChartData(dataList []*data_manage.ChartEdbInfoMapping, seasonExtraCon
 		// 自定义右轴
 		if seasonConfig.RightAxis.IndicatorType != 0 {
 			if seasonConfig.RightAxis.IndicatorType == 1 {
-				startTime, _ := time.ParseInLocation(utils.FormatDate, mappingItem.StartDate,time.Local)
+				startTime, _ := time.ParseInLocation(utils.FormatDate, mappingItem.StartDate, time.Local)
 				for i := len(quarterDataList) - 1; i > len(quarterDataList)-2 && i > 0; i-- {
 					var rightMappingItem data_manage.ChartEdbInfoMapping
 					rightMappingItem = *mappingItem

+ 20 - 0
services/data/excel/excel_info.go

@@ -780,6 +780,26 @@ func GetEdbSourceByEdbInfoIdList(edbInfoIdList []int) (sourceNameList, sourceNam
 		sourceNameList = append(sourceNameList, conf[models.BusinessConfCompanyName])
 		sourceNameEnList = append(sourceNameEnList, conf[models.BusinessConfCompanyName])
 	}
+
+	// (弘则)合规上的要求过滤掉SMM,彭博以及彭博财务;前端那边没办法完全处理掉入口的所以这边也过滤一下
+	if conf[models.BusinessConfHideSourceFormSMM] == "true" {
+		newNames, newEnNames := make([]string, 0), make([]string, 0)
+		for _, v := range sourceNameList {
+			str := strings.ToUpper(v)
+			if str == "SMM" || str == "彭博" || str == "彭博财务" {
+				continue
+			}
+			newNames = append(newNames, v)
+		}
+		for _, v := range sourceNameEnList {
+			str := strings.ToUpper(v)
+			if str == "SMM" || str == "彭博" || str == "彭博财务" {
+				continue
+			}
+			newEnNames = append(newEnNames, v)
+		}
+		return newNames, newEnNames, nil
+	}
 	return
 }