WH01243 пре 9 месеци
родитељ
комит
052837fc36
1 измењених фајлова са 47 додато и 46 уклоњено
  1. 47 46
      api/internal/service/owner.go

+ 47 - 46
api/internal/service/owner.go

@@ -110,56 +110,57 @@ func (t *OwnerService) OwnerlList() map[string]interface{} {
 		returnData = handleRedisCache(listKey)
 		returnData = handleRedisCache(listKey)
 		connectionsNumber = gconv.Int64(redis.GetInt("newother", countKey))
 		connectionsNumber = gconv.Int64(redis.GetInt("newother", countKey))
 		// 处理监控状态
 		// 处理监控状态
-	}
-	log.Println("111", fmt.Sprintf("%+v", key))
-	key = "companyList-" + common.GetMd5String(fmt.Sprintf("%+v", key))
-	// 检查 Redis 中是否存在公司缓存
-	if ok, err := redis.Exists("newother", key); ok && err == nil && t.SourceType != "2" {
-		// 处理可介绍业主人脉
-		returnData = handleRedisCache(key)
-		sortAndPaginateReturnData(&returnData, startIndex, endIndex)
 	} else {
 	} else {
-		// 没有缓存时的处理逻辑
-		if t.PartyA != "" || t.Supplier != "" || t.Heterotophy != "" || t.Intermediary != "" || t.Agency != "" {
-			dataMap = BuyerList(t.PartyA, t.Supplier, t.Heterotophy, t.Intermediary, t.Agency, t.PositionId)
-			if len(*dataMap) == 0 {
-				return map[string]interface{}{
-					"connectionsNumber": 0,
-					"highSuccessNumber": 0,
-					"monitorNumber":     0,
-					"list":              []BuyerProject{},
+		log.Println("111", fmt.Sprintf("%+v", key))
+		key = "companyList-" + common.GetMd5String(fmt.Sprintf("%+v", key))
+		// 检查 Redis 中是否存在公司缓存
+		if ok, err := redis.Exists("newother", key); ok && err == nil && t.SourceType != "2" {
+			// 处理可介绍业主人脉
+			returnData = handleRedisCache(key)
+			sortAndPaginateReturnData(&returnData, startIndex, endIndex)
+		} else {
+			// 没有缓存时的处理逻辑
+			if t.PartyA != "" || t.Supplier != "" || t.Heterotophy != "" || t.Intermediary != "" || t.Agency != "" {
+				dataMap = BuyerList(t.PartyA, t.Supplier, t.Heterotophy, t.Intermediary, t.Agency, t.PositionId)
+				if len(*dataMap) == 0 {
+					return map[string]interface{}{
+						"connectionsNumber": 0,
+						"highSuccessNumber": 0,
+						"monitorNumber":     0,
+						"list":              []BuyerProject{},
+					}
 				}
 				}
+				// 监控状态处理
+				MonitorStatusInit(t.PositionId, dataMap, t.SourceType)
+				// 项目数量查询
+				buyerArr := getBuyerArr(dataMap)
+				// 项目数量处理
+				projectMap, dataMap = ProjectHandle(buyerArr, t.EntAccountId, t.SearchEntName, t.Area, businessStr, dataMap)
+			} else {
+				return map[string]interface{}{}
+			}
+			endTime := time.Now().Unix()
+			fmt.Println("用时时间:", endTime-startTime)
+			if len(*dataMap) == 0 {
+				return map[string]interface{}{}
+			}
+			// 采购单位和项目合并
+			a1 := time.Now().Unix()
+			returnData, connectionsNumber = BuyerProjectMerge(dataMap, projectMap, t.SourceType)
+			a2 := time.Now().Unix()
+			fmt.Println("组合数据", a2-a1)
+			if len(returnData) > 0 {
+				redis.Put("newother", key, returnData, C.CacheTimeOut)
+				sort.Slice(returnData, func(i, j int) bool {
+					aa := fmt.Sprintf("%d%s", (returnData)[i].Zbtime, (returnData)[i].BuyerId)
+					bb := fmt.Sprintf("%d%s", (returnData)[j].Zbtime, (returnData)[j].BuyerId)
+					return aa > bb
+				})
+				// 数组分页处理
+				sortAndPaginateReturnData(&returnData, startIndex, endIndex)
 			}
 			}
-			// 监控状态处理
-			MonitorStatusInit(t.PositionId, dataMap, t.SourceType)
-			// 项目数量查询
-			buyerArr := getBuyerArr(dataMap)
-			// 项目数量处理
-			projectMap, dataMap = ProjectHandle(buyerArr, t.EntAccountId, t.SearchEntName, t.Area, businessStr, dataMap)
-		} else {
-			return map[string]interface{}{}
-		}
-		endTime := time.Now().Unix()
-		fmt.Println("用时时间:", endTime-startTime)
-		if len(*dataMap) == 0 {
-			return map[string]interface{}{}
-		}
-		// 采购单位和项目合并
-		a1 := time.Now().Unix()
-		returnData, connectionsNumber = BuyerProjectMerge(dataMap, projectMap, t.SourceType)
-		a2 := time.Now().Unix()
-		fmt.Println("组合数据", a2-a1)
-		if len(returnData) > 0 {
-			redis.Put("newother", key, returnData, C.CacheTimeOut)
-			sort.Slice(returnData, func(i, j int) bool {
-				aa := fmt.Sprintf("%d%s", (returnData)[i].Zbtime, (returnData)[i].BuyerId)
-				bb := fmt.Sprintf("%d%s", (returnData)[j].Zbtime, (returnData)[j].BuyerId)
-				return aa > bb
-			})
-			// 数组分页处理
-			sortAndPaginateReturnData(&returnData, startIndex, endIndex)
-		}
 
 
+		}
 	}
 	}
 	if ok, err := redis.Exists("newother", listKey); !ok || err != nil || t.SourceType == "2" {
 	if ok, err := redis.Exists("newother", listKey); !ok || err != nil || t.SourceType == "2" {
 		buyerIdArr := getBuyerIdArr(returnData)
 		buyerIdArr := getBuyerIdArr(returnData)