wangchuanjin 9 månader sedan
förälder
incheckning
0c5f350051
1 ändrade filer med 140 tillägg och 142 borttagningar
  1. 140 142
      api/internal/service/network.go

+ 140 - 142
api/internal/service/network.go

@@ -643,163 +643,161 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
 			isTjProject = false
 		}
 	}
-	if isTjProject {
-		entMonitor := NetworkCom.EntMonitor(in.UserId)
-		aio := n.AllIntroduceOwner(sqlAppend1, sqlAppend2, args, isTjProject, businessType, entMonitor)
-		for _, v := range aio.Networks {
-			itype := ""
-			buyer_count, project_count, expect_amount, monitor_count := int64(0), int64(0), float64(0), int64(0)
-			export_id := []string{}
-			jump_type, jump_id := "", ""
-			switch v.Itype {
-			case 1:
-				itype = "甲方"
-				jump_type = "firstparty"
-				for _, vv := range aio.FirstpartyNetwork[v.Company_id] {
-					if jump_id != "" {
-						jump_id += ","
+	entMonitor := NetworkCom.EntMonitor(in.UserId)
+	aio := n.AllIntroduceOwner(sqlAppend1, sqlAppend2, args, isTjProject, businessType, entMonitor)
+	for _, v := range aio.Networks {
+		itype := ""
+		buyer_count, project_count, expect_amount, monitor_count := int64(0), int64(0), float64(0), int64(0)
+		export_id := []string{}
+		jump_type, jump_id := "", ""
+		switch v.Itype {
+		case 1:
+			itype = "甲方"
+			jump_type = "firstparty"
+			for _, vv := range aio.FirstpartyNetwork[v.Company_id] {
+				if jump_id != "" {
+					jump_id += ","
+				}
+				jump_id += vv.CompanyId
+			}
+			if aio.Firstparty[v.Company_id] != nil {
+				buyer_count = aio.Firstparty[v.Company_id].BuyerCount
+				project_count = aio.Firstparty[v.Company_id].ProjectCount
+				expect_amount = aio.Firstparty[v.Company_id].ProjectAmount
+				monitor_count = aio.Firstparty[v.Company_id].MonitorCount
+				export_id = aio.Firstparty[v.Company_id].ExportId
+			}
+		case 2:
+			itype = "供应商"
+			jump_type = "supplier"
+			jump_id = v.Company_id
+			if aio.Supplier[v.Company_id] != nil {
+				buyer_count = aio.Supplier[v.Company_id].BuyerCount
+				project_count = aio.Supplier[v.Company_id].ProjectCount
+				expect_amount = aio.Supplier[v.Company_id].ProjectAmount
+				monitor_count = aio.Supplier[v.Company_id].MonitorCount
+				export_id = aio.Supplier[v.Company_id].ExportId
+			}
+		case 3:
+			itype = "同甲异业渠道"
+			jump_type = "adiffb"
+			jump_id = v.Company_id
+			if aio.Adiffb[v.Company_id] != nil {
+				buyer_count = aio.Adiffb[v.Company_id].BuyerCount
+				project_count = aio.Adiffb[v.Company_id].ProjectCount
+				expect_amount = aio.Adiffb[v.Company_id].ProjectAmount
+				monitor_count = aio.Adiffb[v.Company_id].MonitorCount
+				export_id = aio.Adiffb[v.Company_id].ExportId
+			}
+		case 4:
+			itype = "中间人"
+			jump_type = "middleman"
+			jump_id = fmt.Sprint(v.Id)
+			buyer_count = v.Buyer_count
+			if v.Relate_buyer_name != "" {
+				for _, v := range strings.Split(v.Relate_buyer_name, ",") {
+					if v == "" {
+						continue
+					}
+					if entMonitor[v] {
+						monitor_count++
 					}
-					jump_id += vv.CompanyId
 				}
-				if aio.Firstparty[v.Company_id] != nil {
-					buyer_count = aio.Firstparty[v.Company_id].BuyerCount
-					project_count = aio.Firstparty[v.Company_id].ProjectCount
-					expect_amount = aio.Firstparty[v.Company_id].ProjectAmount
-					monitor_count = aio.Firstparty[v.Company_id].MonitorCount
-					export_id = aio.Firstparty[v.Company_id].ExportId
+			}
+			if v.Relate_project_id != "" {
+				export_id = strings.Split(v.Relate_project_id, ",")
+				for _, v := range export_id {
+					if aio.Middleman[v] != nil {
+						project_count++
+						expect_amount += aio.Middleman[v].ProjectAmount
+					}
 				}
+			}
+		case 5:
+			itype = "招标代理机构"
+			jump_type = "agency"
+			jump_id = v.Company_id
+			if aio.Agency[v.Company_id] != nil {
+				buyer_count = aio.Agency[v.Company_id].BuyerCount
+				project_count = aio.Agency[v.Company_id].ProjectCount
+				expect_amount = aio.Agency[v.Company_id].ProjectAmount
+				monitor_count = aio.Agency[v.Company_id].MonitorCount
+				export_id = aio.Agency[v.Company_id].ExportId
+			}
+		}
+		if buyer_count < in.Buyercount_start {
+			continue
+		} else if in.Buyercount_end > 0 && buyer_count > in.Buyercount_end {
+			continue
+		} else if in.Monitor == 1 && monitor_count <= 0 {
+			continue
+		} else if in.Monitor == -1 && monitor_count > 0 {
+			continue
+		} else if monitor_count < in.Monitorcount_start {
+			continue
+		} else if in.Monitorcount_end > 0 && monitor_count > in.Monitorcount_end {
+			continue
+		} else if in.Project_matchme == 1 && project_count == 0 {
+			continue
+		}
+		if !dbPaging {
+			switch v.Itype {
+			case 1:
+				firstparty_count++
 			case 2:
-				itype = "供应商"
-				jump_type = "supplier"
-				jump_id = v.Company_id
-				if aio.Supplier[v.Company_id] != nil {
-					buyer_count = aio.Supplier[v.Company_id].BuyerCount
-					project_count = aio.Supplier[v.Company_id].ProjectCount
-					expect_amount = aio.Supplier[v.Company_id].ProjectAmount
-					monitor_count = aio.Supplier[v.Company_id].MonitorCount
-					export_id = aio.Supplier[v.Company_id].ExportId
-				}
+				supplier_count++
 			case 3:
-				itype = "同甲异业渠道"
-				jump_type = "adiffb"
-				jump_id = v.Company_id
-				if aio.Adiffb[v.Company_id] != nil {
-					buyer_count = aio.Adiffb[v.Company_id].BuyerCount
-					project_count = aio.Adiffb[v.Company_id].ProjectCount
-					expect_amount = aio.Adiffb[v.Company_id].ProjectAmount
-					monitor_count = aio.Adiffb[v.Company_id].MonitorCount
-					export_id = aio.Adiffb[v.Company_id].ExportId
-				}
+				adiffb_count++
 			case 4:
-				itype = "中间人"
-				jump_type = "middleman"
-				jump_id = fmt.Sprint(v.Id)
-				buyer_count = v.Buyer_count
-				if v.Relate_buyer_name != "" {
-					for _, v := range strings.Split(v.Relate_buyer_name, ",") {
-						if v == "" {
-							continue
-						}
-						if entMonitor[v] {
-							monitor_count++
-						}
-					}
-				}
-				if v.Relate_project_id != "" {
-					export_id = strings.Split(v.Relate_project_id, ",")
-					for _, v := range export_id {
-						if aio.Middleman[v] != nil {
-							project_count++
-							expect_amount += aio.Middleman[v].ProjectAmount
-						}
-					}
-				}
+				middleman_count++
 			case 5:
-				itype = "招标代理机构"
-				jump_type = "agency"
-				jump_id = v.Company_id
-				if aio.Agency[v.Company_id] != nil {
-					buyer_count = aio.Agency[v.Company_id].BuyerCount
-					project_count = aio.Agency[v.Company_id].ProjectCount
-					expect_amount = aio.Agency[v.Company_id].ProjectAmount
-					monitor_count = aio.Agency[v.Company_id].MonitorCount
-					export_id = aio.Agency[v.Company_id].ExportId
-				}
+				agency_count++
 			}
-			if buyer_count < in.Buyercount_start {
-				continue
-			} else if in.Buyercount_end > 0 && buyer_count > in.Buyercount_end {
-				continue
-			} else if in.Monitor == 1 && monitor_count <= 0 {
-				continue
-			} else if in.Monitor == -1 && monitor_count > 0 {
-				continue
-			} else if monitor_count < in.Monitorcount_start {
-				continue
-			} else if in.Monitorcount_end > 0 && monitor_count > in.Monitorcount_end {
-				continue
-			} else if in.Project_matchme == 1 && project_count == 0 {
+			if in.Type != "" && n.TypeStrConvert(in.Type) != v.Itype {
 				continue
 			}
-			if !dbPaging {
-				switch v.Itype {
-				case 1:
-					firstparty_count++
-				case 2:
-					supplier_count++
-				case 3:
-					adiffb_count++
-				case 4:
-					middleman_count++
-				case 5:
-					agency_count++
-				}
-				if in.Type != "" && n.TypeStrConvert(in.Type) != v.Itype {
+		}
+		export_url := ""
+		if len(export_id) > 0 {
+			exportIdRepeat := map[string]bool{}
+			exportId := ""
+			for _, v := range export_id {
+				if exportIdRepeat[v] {
 					continue
 				}
-			}
-			export_url := ""
-			if len(export_id) > 0 {
-				exportIdRepeat := map[string]bool{}
-				exportId := ""
-				for _, v := range export_id {
-					if exportIdRepeat[v] {
-						continue
-					}
-					exportIdRepeat[v] = true
-					if exportId != "" {
-						exportId += ","
-					}
-					exportId += v
+				exportIdRepeat[v] = true
+				if exportId != "" {
+					exportId += ","
 				}
-				md5Id := GetMd5String(exportId)
-				redis.Put("newother", fmt.Sprintf("network_export_%s", md5Id), exportId, 259200)
-				export_url = "/subscribepay/network/projectExport?export_id=" + md5Id
-			}
-			url := ""
-			if v.Qyxy_id != "" && (jump_type == "supplier" || jump_type == "adiffb") {
-				url = "/swordfish/page_big_pc/ent_portrait/" + encrypt.EncodeArticleId2ByCheck(v.Qyxy_id)
-			} else if jump_type == "firstparty" && v.Company_name != "" {
-				url = "/swordfish/page_big_pc/unit_portrayal/" + v.Company_name
+				exportId += v
 			}
-			list = append(list, &map[string]interface{}{
-				"company_id":    v.Company_id,
-				"company_name":  v.Company_name,
-				"type":          itype,
-				"jump_type":     jump_type,
-				"jump_id":       jump_id,
-				"person":        v.Person,
-				"phone":         v.Phone,
-				"buyer_count":   buyer_count,
-				"monitor_count": monitor_count,
-				"expect_amount": RetainDecimal(expect_amount/10000, 2),
-				"project_count": project_count,
-				"create_time":   v.Create_time,
-				"export_url":    export_url,
-				"url":           url,
-				"id":            v.Id,
-			})
+			md5Id := GetMd5String(exportId)
+			redis.Put("newother", fmt.Sprintf("network_export_%s", md5Id), exportId, 259200)
+			export_url = "/subscribepay/network/projectExport?export_id=" + md5Id
 		}
+		url := ""
+		if v.Qyxy_id != "" && (jump_type == "supplier" || jump_type == "adiffb") {
+			url = "/swordfish/page_big_pc/ent_portrait/" + encrypt.EncodeArticleId2ByCheck(v.Qyxy_id)
+		} else if jump_type == "firstparty" && v.Company_name != "" {
+			url = "/swordfish/page_big_pc/unit_portrayal/" + v.Company_name
+		}
+		list = append(list, &map[string]interface{}{
+			"company_id":    v.Company_id,
+			"company_name":  v.Company_name,
+			"type":          itype,
+			"jump_type":     jump_type,
+			"jump_id":       jump_id,
+			"person":        v.Person,
+			"phone":         v.Phone,
+			"buyer_count":   buyer_count,
+			"monitor_count": monitor_count,
+			"expect_amount": RetainDecimal(expect_amount/10000, 2),
+			"project_count": project_count,
+			"create_time":   v.Create_time,
+			"export_url":    export_url,
+			"url":           url,
+			"id":            v.Id,
+		})
 	}
 	csList := &ComSortList{
 		SortKeys: []*ComSortKey{