Jianghan 1 سال پیش
والد
کامیت
2ec388f1d1
3فایلهای تغییر یافته به همراه43 افزوده شده و 16 حذف شده
  1. 1 1
      api/internal/logic/coophistorylistlogic.go
  2. 32 14
      api/internal/service/CoopHistoryService.go
  3. 10 1
      api/internal/service/owner.go

+ 1 - 1
api/internal/logic/coophistorylistlogic.go

@@ -29,7 +29,7 @@ func (l *CoopHistoryListLogic) CoopHistoryList(req *types.CoopHistoryReq) (resp
 	result := service.GetPrList(req)
 	if result == nil {
 		resp.Error_code = -1
-		resp.Error_msg = "未查询到项目信息"
+		resp.Error_msg = "查询异常"
 	} else {
 		resp.Data = map[string]interface{}{
 			"list": result,

+ 32 - 14
api/internal/service/CoopHistoryService.go

@@ -87,9 +87,17 @@ type ResultData struct {
 	data        []map[string]interface{} `json:"data"`
 }
 
+type ProjectTmp struct {
+	Buyer        string   `ch:"buyer"`
+	BuyerId      string   `ch:"buyer_id"`
+	Agency       string   `ch:"agency"`
+	AgencyId     string   `ch:"agency_id"`
+	PropertyForm []string `ch:"property_form"`
+}
+
 func GetPrList(req *types.CoopHistoryReq) (result []*ResultData) {
-	pMap := make(map[string]interface{})
-	err := T.ClickhouseConn.QueryRow(context.TODO(), sql_2_0, req.Pid).Scan(&pMap)
+	pTmp := ProjectTmp{}
+	err := T.ClickhouseConn.QueryRow(context.TODO(), sql_2_0, req.Pid).ScanStruct(&pTmp)
 	if err != nil {
 		return nil
 	}
@@ -101,7 +109,7 @@ func GetPrList(req *types.CoopHistoryReq) (result []*ResultData) {
 
 	// 1、同甲异业数据/招标代理机构渠道
 	if propertyForm != "" {
-		r1, r2 := GetData(propertyForm, common.ObjToString(pMap["buyer_id"]))
+		r1, r2 := GetData(propertyForm, pTmp.BuyerId)
 		if r1 != nil && len(r1) > 0 {
 			tmp := &ResultData{
 				channelType: 1,
@@ -122,19 +130,29 @@ func GetPrList(req *types.CoopHistoryReq) (result []*ResultData) {
 		}
 	}
 	// 中间人可介绍业主
-	r3 := GetData1(req.PositionId, common.ObjToString(pMap["buyer_id"]))
-	if r3 != nil && len(r3) > 0 {
-		tmp := &ResultData{
-			channelType: 1,
-			channel:     "中间人",
-			size:        len(r3),
-			data:        r3,
+	if pTmp.BuyerId != "" {
+		r3 := GetData1(req.PositionId, pTmp.BuyerId)
+		if r3 != nil && len(r3) > 0 {
+			tmp := &ResultData{
+				channelType: 1,
+				channel:     "中间人",
+				size:        len(r3),
+				data:        r3,
+			}
+			result = append(result, tmp)
+		}
+		// 关联单位
+		r4 := GetData2(pTmp.BuyerId)
+		if r4 != nil && len(r4) > 0 {
+			tmp := &ResultData{
+				channelType: 1,
+				channel:     "业主关联单位",
+				size:        len(r4),
+				data:        r4,
+			}
+			result = append(result, tmp)
 		}
-		result = append(result, tmp)
 	}
-	// 关联单位
-	GetData2(common.ObjToString(pMap["buyer_id"]))
-
 	return
 }
 

+ 10 - 1
api/internal/service/owner.go

@@ -927,7 +927,16 @@ func (t *OwnerService) CandidateChannel() []*ResultData {
 				}
 				returnData = append(returnData, tmp)
 			}
-			GetData2(buyerId)
+			r4 := GetData2(buyerId)
+			if r4 != nil && len(r4) > 0 {
+				tmp := &ResultData{
+					channelType: 1,
+					channel:     "业主关联单位",
+					size:        len(r4),
+					data:        r4,
+				}
+				returnData = append(returnData, tmp)
+			}
 		}
 
 	}