|
@@ -55,13 +55,13 @@ type WinnerSimpleData struct {
|
|
Name, Business string
|
|
Name, Business string
|
|
}
|
|
}
|
|
|
|
|
|
-//采购单位最新中标动态数量查询
|
|
|
|
|
|
+// 采购单位最新中标动态数量查询
|
|
func GetBuyerNewProjectCount(buyer string) int64 {
|
|
func GetBuyerNewProjectCount(buyer string) int64 {
|
|
defer qutil.Catch()
|
|
defer qutil.Catch()
|
|
return elastic.Count("projectset", "projectset", `{"query":{"bool":{"must":[{"term": {"buyer": "`+buyer+`"}}]}}}`)
|
|
return elastic.Count("projectset", "projectset", `{"query":{"bool":{"must":[{"term": {"buyer": "`+buyer+`"}}]}}}`)
|
|
}
|
|
}
|
|
|
|
|
|
-//获取采购单位基本信息
|
|
|
|
|
|
+// 获取采购单位基本信息
|
|
func GetBuyerMsg(entName string) (city, province, buyerclass string) {
|
|
func GetBuyerMsg(entName string) (city, province, buyerclass string) {
|
|
list := elastic.Get("buyer", "buyer", fmt.Sprintf(buyer_query_address, entName))
|
|
list := elastic.Get("buyer", "buyer", fmt.Sprintf(buyer_query_address, entName))
|
|
if list == nil || len(*list) == 0 {
|
|
if list == nil || len(*list) == 0 {
|
|
@@ -74,7 +74,7 @@ func GetBuyerMsg(entName string) (city, province, buyerclass string) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//GetBuyerPortraitData 采购单位画像
|
|
|
|
|
|
+// GetBuyerPortraitData 采购单位画像
|
|
func GetBuyerPortraitData(screen *PortraitScreen) (map[string]interface{}, error) {
|
|
func GetBuyerPortraitData(screen *PortraitScreen) (map[string]interface{}, error) {
|
|
buyerPortraitData, err := BuyerPortraitSearch(screen) //查询采购单位画像
|
|
buyerPortraitData, err := BuyerPortraitSearch(screen) //查询采购单位画像
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -454,7 +454,7 @@ func BuyerPortraitSearch(screen *PortraitScreen) (map[string]interface{}, error)
|
|
mustQueryArr = append(mustQueryArr, fmt.Sprintf(`{"term":{"buyer":"%s"}}`, screen.Ent))
|
|
mustQueryArr = append(mustQueryArr, fmt.Sprintf(`{"term":{"buyer":"%s"}}`, screen.Ent))
|
|
|
|
|
|
//按照当前年份,往前推4年,共5个年份可选
|
|
//按照当前年份,往前推4年,共5个年份可选
|
|
- mustQueryArr = append(mustQueryArr, fmt.Sprintf(`{"range":{"firsttime":{"gte":"%d","lt":"%d"}}}`, startTime.Unix(), endTime.Unix()))
|
|
|
|
|
|
+ mustQueryArr = append(mustQueryArr, fmt.Sprintf(`{"range":{"jgtime":{"gte":"%d","lt":"%d"}}}`, startTime.Unix(), endTime.Unix()))
|
|
|
|
|
|
//文本输入框,字数限制50个字,超过上限不再允许输入内容
|
|
//文本输入框,字数限制50个字,超过上限不再允许输入内容
|
|
if screen.Match != "" {
|
|
if screen.Match != "" {
|
|
@@ -806,7 +806,7 @@ type AllWinner struct {
|
|
RateAmountCount float64 //中标总额(筛选过),用于计算折扣率
|
|
RateAmountCount float64 //中标总额(筛选过),用于计算折扣率
|
|
}
|
|
}
|
|
|
|
|
|
-//GetWithEntPortraitData 查询采购单位合作企业画像
|
|
|
|
|
|
+// GetWithEntPortraitData 查询采购单位合作企业画像
|
|
func GetWithEntPortraitData(listDataItf interface{}, province string, bidamountObj interface{}) (map[string]interface{}, int, error) {
|
|
func GetWithEntPortraitData(listDataItf interface{}, province string, bidamountObj interface{}) (map[string]interface{}, int, error) {
|
|
listData := &[]AllWinner{}
|
|
listData := &[]AllWinner{}
|
|
if err := InterfaceToStruct(listDataItf, listData); err != nil {
|
|
if err := InterfaceToStruct(listDataItf, listData); err != nil {
|
|
@@ -995,7 +995,7 @@ func GetWithEntPortraitData(listDataItf interface{}, province string, bidamountO
|
|
return returnData, thisProvinceWinnerCount, nil
|
|
return returnData, thisProvinceWinnerCount, nil
|
|
}
|
|
}
|
|
|
|
|
|
-//获取金额分段key
|
|
|
|
|
|
+// 获取金额分段key
|
|
func ReturnAmountKey(amountValue float64) int {
|
|
func ReturnAmountKey(amountValue float64) int {
|
|
for tValue := len(capitalRange) - 1; tValue > 0; tValue-- {
|
|
for tValue := len(capitalRange) - 1; tValue > 0; tValue-- {
|
|
if amountValue >= float64(capitalRange[tValue]) {
|
|
if amountValue >= float64(capitalRange[tValue]) {
|
|
@@ -1005,7 +1005,7 @@ func ReturnAmountKey(amountValue float64) int {
|
|
return 0
|
|
return 0
|
|
}
|
|
}
|
|
|
|
|
|
-//获取年份分段key
|
|
|
|
|
|
+// 获取年份分段key
|
|
func ReturnYearKey(t time.Time) int {
|
|
func ReturnYearKey(t time.Time) int {
|
|
thisDiffer := time.Now().Year() - t.Year()
|
|
thisDiffer := time.Now().Year() - t.Year()
|
|
for tYear := len(yearsRange) - 1; tYear > 0; tYear-- {
|
|
for tYear := len(yearsRange) - 1; tYear > 0; tYear-- {
|
|
@@ -1016,7 +1016,7 @@ func ReturnYearKey(t time.Time) int {
|
|
return 0
|
|
return 0
|
|
}
|
|
}
|
|
|
|
|
|
-//核算
|
|
|
|
|
|
+// 核算
|
|
func mAggsSum(winnerName []string, AllData map[string]AllWinner) (mCount float64, eCount, pCount int, rAvg interface{}) {
|
|
func mAggsSum(winnerName []string, AllData map[string]AllWinner) (mCount float64, eCount, pCount int, rAvg interface{}) {
|
|
budget, amount := 0.0, 0.0
|
|
budget, amount := 0.0, 0.0
|
|
for _, name := range winnerName {
|
|
for _, name := range winnerName {
|
|
@@ -1035,10 +1035,10 @@ func mAggsSum(winnerName []string, AllData map[string]AllWinner) (mCount float64
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//根据用户设置行业 展示重点合作企业列表
|
|
|
|
-//若读者(投标企业)所在的行业排名在前 5,则取前 5 行业+其他(没被列出的所有行业)
|
|
|
|
-//若读者(投标企业)所在的行业排名不在前 5,则取前 4 行业+读者所在行业+其他
|
|
|
|
-//识别不到读者(投标企业)所在的行业,则用第一种方案
|
|
|
|
|
|
+// 根据用户设置行业 展示重点合作企业列表
|
|
|
|
+// 若读者(投标企业)所在的行业排名在前 5,则取前 5 行业+其他(没被列出的所有行业)
|
|
|
|
+// 若读者(投标企业)所在的行业排名不在前 5,则取前 4 行业+读者所在行业+其他
|
|
|
|
+// 识别不到读者(投标企业)所在的行业,则用第一种方案
|
|
func formatUserTopShowList(userId string, allTopShow interface{}) []TopShow {
|
|
func formatUserTopShowList(userId string, allTopShow interface{}) []TopShow {
|
|
alltopShowStruct := &[]TopShow{}
|
|
alltopShowStruct := &[]TopShow{}
|
|
if err := InterfaceToStruct(allTopShow, alltopShowStruct); err != nil {
|
|
if err := InterfaceToStruct(allTopShow, alltopShowStruct); err != nil {
|
|
@@ -1101,7 +1101,7 @@ func formatUserTopShowList(userId string, allTopShow interface{}) []TopShow {
|
|
return retuenData
|
|
return retuenData
|
|
}
|
|
}
|
|
|
|
|
|
-//根据id获取企业名称
|
|
|
|
|
|
+// 根据id获取企业名称
|
|
func GetWinnerNamesByIds(ids []string) (returnMap map[string]string) {
|
|
func GetWinnerNamesByIds(ids []string) (returnMap map[string]string) {
|
|
tBegin := time.Now()
|
|
tBegin := time.Now()
|
|
returnMap = map[string]string{}
|
|
returnMap = map[string]string{}
|
|
@@ -1174,9 +1174,9 @@ func GetExpire(entName string, startTime, endTime int64, start, limit int) (res
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//getAllEntIdAndFormat 从所有数据中补全首次合作信息,并返回前limit的id信息
|
|
|
|
-//tf 仅首次合作企业的id无具体统计数据,全量数据在fullData中
|
|
|
|
-//此方法从fullData中取前limit条首次合作的企业,并返回企业id列表
|
|
|
|
|
|
+// getAllEntIdAndFormat 从所有数据中补全首次合作信息,并返回前limit的id信息
|
|
|
|
+// tf 仅首次合作企业的id无具体统计数据,全量数据在fullData中
|
|
|
|
+// 此方法从fullData中取前limit条首次合作的企业,并返回企业id列表
|
|
func (tf *customWinnerList) getAllEntIdAndFormat(fullData *customWinnerList, limit int, isTop bool) (nList *customWinnerList, ids []string) {
|
|
func (tf *customWinnerList) getAllEntIdAndFormat(fullData *customWinnerList, limit int, isTop bool) (nList *customWinnerList, ids []string) {
|
|
sourceData, nList := fullData, &customWinnerList{}
|
|
sourceData, nList := fullData, &customWinnerList{}
|
|
for _, winnerData := range sourceData.Buckets {
|
|
for _, winnerData := range sourceData.Buckets {
|
|
@@ -1202,7 +1202,7 @@ func (tf *customWinnerList) getAllEntIdAndFormat(fullData *customWinnerList, lim
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//formatData 格式化返回数据并计算节制率
|
|
|
|
|
|
+// formatData 格式化返回数据并计算节制率
|
|
func (tf *customWinnerList) formatData(entInfo map[string]*WinnerSimpleData) (res []map[string]interface{}) {
|
|
func (tf *customWinnerList) formatData(entInfo map[string]*WinnerSimpleData) (res []map[string]interface{}) {
|
|
for _, item := range tf.Buckets {
|
|
for _, item := range tf.Buckets {
|
|
if wMsg, ok := entInfo[item.Key]; ok {
|
|
if wMsg, ok := entInfo[item.Key]; ok {
|
|
@@ -1220,7 +1220,7 @@ func (tf *customWinnerList) formatData(entInfo map[string]*WinnerSimpleData) (re
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//onceGetWinnerMsgByIds 根据id获取企业基本信息名称
|
|
|
|
|
|
+// onceGetWinnerMsgByIds 根据id获取企业基本信息名称
|
|
func onceGetWinnerMsgByIds(ids []string) (returnMap map[string]*WinnerSimpleData) {
|
|
func onceGetWinnerMsgByIds(ids []string) (returnMap map[string]*WinnerSimpleData) {
|
|
tBegin := time.Now()
|
|
tBegin := time.Now()
|
|
returnMap = map[string]*WinnerSimpleData{}
|
|
returnMap = map[string]*WinnerSimpleData{}
|