Browse Source

字段为空处理

WH01243 1 year ago
parent
commit
ba37e6452b
1 changed files with 21 additions and 9 deletions
  1. 21 9
      api/internal/service/owner.go

+ 21 - 9
api/internal/service/owner.go

@@ -659,21 +659,32 @@ func BuyerList(partyA, supplier, heterotophy, intermediary, agency string, posit
 	if partyA != "" {
 		intermediaryArr := []string{}
 		for _, v := range strings.Split(partyA, ",") {
-			intermediaryArr = append(intermediaryArr, fmt.Sprintf("'%s'", v))
-
+			if v != "" {
+				intermediaryArr = append(intermediaryArr, fmt.Sprintf("'%s'", v))
+			}
+		}
+		if len(partyA) > 0 {
+			partyASql := fmt.Sprintf(`select  id as buyer_id,company_name as buyer  from  ent_info   where  id in (%s)`, strings.Join(intermediaryArr, ","))
+			FindHandle(partyASql, dataMap)
 		}
-		partyASql := fmt.Sprintf(`select  id as buyer_id,company_name as buyer  from  ent_info   where  id in (%s)`, strings.Join(intermediaryArr, ","))
-		FindHandle(partyASql, dataMap)
 	}
 	//供应商 //同甲异业
-	if supplier != "" || heterotophy != "" {
-		findInSetArr := []string{}
+	findInSetArr := []string{}
+	if supplier != "" {
 		for _, v := range strings.Split(supplier, ",") {
-			findInSetArr = append(findInSetArr, fmt.Sprintf("'%s'", v))
+			if v != "" {
+				findInSetArr = append(findInSetArr, fmt.Sprintf("'%s'", v))
+			}
 		}
+	}
+	if heterotophy != "" {
 		for _, v := range strings.Split(heterotophy, ",") {
-			findInSetArr = append(findInSetArr, fmt.Sprintf("'%s'", v))
+			if v != "" {
+				findInSetArr = append(findInSetArr, fmt.Sprintf("'%s'", v))
+			}
 		}
+	}
+	if len(findInSetArr) > 0 {
 		sqlStr := fmt.Sprintf(`SELECT buyer_id,buyer FROM transaction_info where  hasAny(winner_id,[%s])    `, strings.Join(findInSetArr, ","))
 		FindHandle(sqlStr, dataMap)
 	}
@@ -748,7 +759,7 @@ func ProjectHandle(buyerArr []string, positionId int64, entName, area, sourceTyp
 			(*projectMap)[buyerName] = map[string]interface{}{
 				"area":    area,
 				"zbtime":  v.Zbtime_count.Value,
-				"money":   gconv.Int64((common.Float64All(v.Money_count.Value) * 10000)),
+				"money":   gconv.Int64(common.Float64All(v.Money_count.Value) * 10000),
 				"count":   v.Doc_count,
 				"buyerId": buyerId,
 			}
@@ -1075,5 +1086,6 @@ func (t *OwnerService) CandidateChannel() []*ResultData {
 			}
 		}
 	}
+
 	return returnData
 }