Explorar o código

Merge branch 'feature/v1.0.4' of https://jygit.jydev.jianyu360.cn/CRM/application into feature/v1.0.4

wangchuanjin hai 1 ano
pai
achega
2e154c9895

+ 6 - 11
api/internal/logic/coophistorylistlogic.go

@@ -26,17 +26,12 @@ func NewCoopHistoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *C
 func (l *CoopHistoryListLogic) CoopHistoryList(req *types.CoopHistoryReq) (resp *types.Reply, err error) {
 	resp = &types.Reply{}
 	result, size1, size2, size3, size4 := service.GetPrList(req)
-	if result == nil {
-		resp.Error_code = -1
-		resp.Error_msg = "查询异常"
-	} else {
-		resp.Data = map[string]interface{}{
-			"list":  result,
-			"size1": size1,
-			"size2": size2,
-			"size3": size3,
-			"size4": size4,
-		}
+	resp.Data = map[string]interface{}{
+		"list":  result,
+		"size1": size1,
+		"size2": size2,
+		"size3": size3,
+		"size4": size4,
 	}
 
 	return

+ 1 - 1
api/internal/service/CoopHistoryService.go

@@ -53,7 +53,7 @@ func GetPrList(req *types.CoopHistoryReq) (result []*ResultData, size_1, size_2,
 		return nil, 0, 0, 0, 0
 	}
 	propertyForm := ""
-	m1 := T.CrmMysql.FindOne("config_tenant", map[string]interface{}{"account_id": req.EntAccountId}, "probusfor", "")
+	m1 := T.CrmMysql.FindOne("config_tenant", map[string]interface{}{"entAccountId": req.EntAccountId}, "probusfor", "")
 	if m1 != nil && len(*m1) > 0 {
 		propertyForm = common.ObjToString((*m1)["probusfor"])
 	}

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

@@ -101,11 +101,11 @@ func (t *OwnerService) OwnerlList() map[string]interface{} {
 			buyerArr = append(buyerArr, fmt.Sprintf(`"%s"`, gconv.String(value["buyerName"])))
 		}
 		//项目数量处理
-		projectMap, _ = ProjectHandle(buyerArr, t.EntAccountId, t.SearchEntName, t.Area, t.ProjectType)
+		projectMap, _, dataMap = ProjectHandle(buyerArr, t.EntAccountId, t.SearchEntName, t.Area, t.ProjectType, dataMap)
 	} else if t.SearchEntName != "" {
 		//1 只看转介绍成功率高2只看已监控的
 		//先查找采购单位数据
-		projectMap, dataMap = ProjectHandle([]string{}, t.EntAccountId, t.SearchEntName, t.Area, t.ProjectType)
+		projectMap, dataMap, _ = ProjectHandle([]string{}, t.EntAccountId, t.SearchEntName, t.Area, t.ProjectType, dataMap)
 		a7 := time.Now().Unix()
 		fmt.Println("es用时", a7-startTime)
 		if t.ProcessingStatus != "" {
@@ -717,7 +717,7 @@ func BuyerList(partyA, supplier, heterotophy, intermediary, agency string, posit
 }
 
 // 项目数量查询
-func ProjectHandle(buyerArr []string, entAccountId int64, entName, area, projectType string) (*map[string]map[string]interface{}, *map[string]map[string]interface{}) {
+func ProjectHandle(buyerArr []string, entAccountId int64, entName, area, projectType string, dataMap *map[string]map[string]interface{}) (*map[string]map[string]interface{}, *map[string]map[string]interface{}, *map[string]map[string]interface{}) {
 	projectMap := &map[string]map[string]interface{}{}
 	returnMap := &map[string]map[string]interface{}{}
 	sql := ""
@@ -747,7 +747,7 @@ func ProjectHandle(buyerArr []string, entAccountId int64, entName, area, project
 	endTime := time.Now().Unix()
 	fmt.Println("es用时时间:", endTime-startTime)
 	if len(data) == 0 {
-		return projectMap, returnMap
+		return projectMap, returnMap, dataMap
 	}
 	for _, object := range data {
 		buyerArr := BuyerAggStruct{}
@@ -780,17 +780,28 @@ func ProjectHandle(buyerArr []string, entAccountId int64, entName, area, project
 			(*returnMap)[buyerId] = map[string]interface{}{
 				"buyerName": buyerName,
 			}
+
 		}
 	}
 	if projectType == "1" {
-		for _, v := range *returnMap {
-			buyerName := gconv.String(v["buyerName"])
-			if _, ok := (*projectMap)[buyerName]; !ok {
-				delete(*returnMap, buyerName)
+		if entName == "" {
+			for buyerId, v := range *dataMap {
+				buyerName := gconv.String(v["buyerName"])
+				if _, ok := (*projectMap)[buyerName]; !ok {
+					delete(*dataMap, buyerId)
+				}
+			}
+		} else {
+			for buyerId, v := range *returnMap {
+				buyerName := gconv.String(v["buyerName"])
+				if _, ok := (*projectMap)[buyerName]; !ok {
+					delete(*returnMap, buyerId)
+				}
 			}
 		}
+
 	}
-	return projectMap, returnMap
+	return projectMap, returnMap, dataMap
 }
 
 type BuyerAggStruct struct {