|
@@ -548,7 +548,7 @@ type AllWinner struct {
|
|
|
}
|
|
|
|
|
|
// GetWithEntPortraitData 查询采购单位合作企业画像
|
|
|
-func GetWithEntPortraitData(listDataItf interface{}, province string, bidamountObj, project_count interface{}) (map[string]interface{}, int, error) {
|
|
|
+func GetWithEntPortraitData(listDataItf interface{}, province string, bidamountObj11, project_count11 interface{}) (map[string]interface{}, int, error) {
|
|
|
listData := &[]AllWinner{}
|
|
|
if err := InterfaceToStruct(listDataItf, listData); err != nil {
|
|
|
return nil, 0, err
|
|
@@ -560,16 +560,21 @@ func GetWithEntPortraitData(listDataItf interface{}, province string, bidamountO
|
|
|
var winnerIdList []string
|
|
|
allWinnerMap := map[string]AllWinner{}
|
|
|
|
|
|
- capitalAggs := map[int][]string{} //注册资本
|
|
|
- areaAggs := map[string][]string{} //地区
|
|
|
- establishAggs := map[int][]string{} //成立日期
|
|
|
- businessAggs := map[string][]string{} //企业标签
|
|
|
+ capitalAggs := map[int][]string{} //注册资本
|
|
|
+ areaAggs := map[string][]string{} //地区
|
|
|
+ establishAggs := map[int][]string{} //成立日期
|
|
|
+ businessAggs := map[string][]string{} //企业标签
|
|
|
+
|
|
|
hasTagTotalBidAmount, hasTagProjectCount := 0.0, 0 //有企业分类中标总金额,其他归为"其他分类"
|
|
|
+ totalBidAmount, totalProjectCount := 0.0, 0
|
|
|
+
|
|
|
for _, winner := range *listData {
|
|
|
if !(winner.WinnerId == "" || winner.WinnerId == "-") {
|
|
|
winnerIdList = append(winnerIdList, winner.WinnerId)
|
|
|
allWinnerMap[winner.WinnerId] = winner
|
|
|
}
|
|
|
+ totalBidAmount += winner.RateAmountCount
|
|
|
+ totalProjectCount += winner.ProjectCount
|
|
|
}
|
|
|
|
|
|
tBegin := time.Now()
|
|
@@ -729,7 +734,6 @@ func GetWithEntPortraitData(listDataItf interface{}, province string, bidamountO
|
|
|
}
|
|
|
//核算企业标签
|
|
|
if len(businessAggs) > 0 {
|
|
|
- bidamount := qutil.Float64All(bidamountObj)
|
|
|
var businessData []map[string]interface{}
|
|
|
for businessName, winnerNames := range businessAggs {
|
|
|
mCount, _, pCount, rAvg := mAggsSum(winnerNames, allWinnerMap)
|
|
@@ -740,8 +744,8 @@ func GetWithEntPortraitData(listDataItf interface{}, province string, bidamountO
|
|
|
if b <= 0 {
|
|
|
return nil
|
|
|
}
|
|
|
- return mCount / bidamount
|
|
|
- }(mCount, bidamount), //采购规模占比
|
|
|
+ return mCount / totalBidAmount
|
|
|
+ }(mCount, totalBidAmount), //采购规模占比
|
|
|
"money_count": mCount, //采购规模
|
|
|
"project_count": pCount, //项目数量
|
|
|
"rate_avg": rAvg, //平均节支率
|
|
@@ -749,18 +753,18 @@ func GetWithEntPortraitData(listDataItf interface{}, province string, bidamountO
|
|
|
}
|
|
|
}
|
|
|
// 根据entid未查到企业信息、项目中entidlist数据不存在、项目中entidlist为[-],统一划分为【其他】类型、以保证占比相加等于1
|
|
|
- if mCount := bidamount - hasTagTotalBidAmount; mCount > 0 {
|
|
|
+ if mCount := totalBidAmount - hasTagTotalBidAmount; mCount > 0 {
|
|
|
businessData = append(businessData, map[string]interface{}{
|
|
|
"business_name": "其他",
|
|
|
"money_prop": func(m, b float64) interface{} {
|
|
|
if b <= 0 {
|
|
|
return nil
|
|
|
}
|
|
|
- return mCount / bidamount
|
|
|
- }(mCount, bidamount), //采购规模占比
|
|
|
- "money_count": mCount, //采购规模
|
|
|
- "project_count": qutil.IntAll(project_count) - hasTagProjectCount, //项目数量
|
|
|
- "rate_avg": 0, //平均节支率(因包含未抽取到中标企业,中标企业id为-,无法计算)
|
|
|
+ return mCount / totalBidAmount
|
|
|
+ }(mCount, totalBidAmount), //采购规模占比
|
|
|
+ "money_count": mCount, //采购规模
|
|
|
+ "project_count": qutil.IntAll(totalProjectCount) - hasTagProjectCount, //项目数量
|
|
|
+ "rate_avg": 0, //平均节支率(因包含未抽取到中标企业,中标企业id为-,无法计算)
|
|
|
})
|
|
|
}
|
|
|
returnData["withBusinessData"] = businessData
|