Bläddra i källkod

列表数据排序

WH01243 1 år sedan
förälder
incheckning
24b0725d87
1 ändrade filer med 14 tillägg och 51 borttagningar
  1. 14 51
      api/internal/service/owner.go

+ 14 - 51
api/internal/service/owner.go

@@ -94,7 +94,7 @@ func (t *OwnerService) OwnerlList() map[string]interface{} {
 	} else if t.SearchEntName != "" {
 		//1 只看转介绍成功率高2只看已监控的
 		//先查找采购单位数据
-		dataMap, projectMap = ProjectHandle([]string{}, t.PositionId, t.SearchEntName, t.Area, t.SourceType, t.ProcessingStatus)
+		projectMap, dataMap = ProjectHandle([]string{}, t.PositionId, t.SearchEntName, t.Area, t.SourceType, t.ProcessingStatus)
 		if t.ProcessingStatus != "" {
 			ProcessingStatusInit(t.PositionId, dataMap, t.ProcessingStatus)
 		}
@@ -132,8 +132,8 @@ func (t *OwnerService) OwnerlList() map[string]interface{} {
 		buyerIdArr = append(buyerIdArr, fmt.Sprintf("'%s'", value.BuyerId))
 	}
 	//可介绍业主人脉处理
-	companyList := ConnectionsHandle(buyerIdArr, t.PositionId, false)
-	for _, v := range companyList {
+	routeList := ConnectionsHandle(buyerIdArr, t.PositionId, false)
+	for _, v := range routeList {
 		buyerId := gconv.String(v["a_id"])
 		for i, v1 := range returnData {
 			aBuyerId := v1.BuyerId
@@ -462,51 +462,6 @@ func MonitorStatusInit(positionId int64, dataMap *map[string]map[string]interfac
 	}
 }
 
-// 监控数据查询初始化
-func FindMonitor(positionId int64, entName string) map[string]bool {
-	nameMap := map[string]bool{}
-	clist, ok := Mgo.Find("", map[string]interface{}{
-		"userId": positionId,
-		"name":   fmt.Sprintf(" /.*%s.*/i", entName),
-	}, "", `{"name":1}`, false, -1, -1)
-	if ok && clist != nil && len(*clist) > 0 {
-		for _, v := range *clist {
-			nameMap[gconv.String(v)] = true
-		}
-	}
-	return nameMap
-}
-func FindProcessingStatus(positionId int64) (map[string]bool, map[string]bool, map[string]bool) {
-	//未处理
-	untreatedMap := map[string]bool{}
-	//已忽略
-	ignoredMap := map[string]bool{}
-	//已创建
-	createdMap := map[string]bool{}
-	processingArr := CrmMysql.Find(entity.CONNECTION_STATUS, map[string]interface{}{
-		"type":        1,
-		"position id": positionId,
-	}, "relate_id,is_handle,is_ignore,is_create", "", -1, -1)
-	if len(*processingArr) > 0 {
-		for _, v := range *processingArr {
-			entId := gconv.String(v["relate_id"])
-			handle := gconv.Int64(v["is_handle"])
-			ignore := gconv.Int64(v["is_ignore"])
-			create := gconv.Int64(v["is_create"])
-			if handle == 1 {
-				untreatedMap[entId] = true
-			}
-			if ignore == 1 {
-				ignoredMap[entId] = true
-			}
-			if create == 1 {
-				createdMap[entId] = true
-			}
-		}
-	}
-	return untreatedMap, ignoredMap, createdMap
-}
-
 // 处理状态初始化
 func ProcessingStatusInit(positionId int64, dataMap *map[string]map[string]interface{}, processingStatus string) {
 	//未处理
@@ -612,7 +567,6 @@ func BuyerList(partyA, supplier, heterotophy, intermediary, agency string) *map[
 
 // 项目数量查询
 func ProjectHandle(buyerArr []string, positionId int64, entName, area, sourceType, processingStatus string) (*map[string]map[string]interface{}, *map[string]map[string]interface{}) {
-
 	projectMap := &map[string]map[string]interface{}{}
 	returnMap := &map[string]map[string]interface{}{}
 	sql := ""
@@ -797,10 +751,19 @@ func Deduplication(a, b string) string {
 
 // 路径列表
 func (t *OwnerService) OwnerRoute() []map[string]interface{} {
-	companyList := ConnectionsHandle([]string{
+	routeList := ConnectionsHandle([]string{
 		fmt.Sprintf("'%s'", t.BuyerId),
 	}, t.PositionId, false)
-	return companyList
+	for i, routeMap := range routeList {
+		sourceType := gconv.String(routeMap["sourceType"])
+		if sourceType == "agency" || sourceType == "supplier" {
+			data := routeList[i]
+			data["cooperateCount"] = len(gconv.Maps(data["list"]))
+			delete(data, "list")
+			routeList[i] = data
+		}
+	}
+	return routeList
 }
 
 // 合作列表