|
@@ -80,19 +80,18 @@ func GetProjectList(req *types.ProjectListReq) *ProjectData {
|
|
|
if businessStr == "" {
|
|
|
return projectData
|
|
|
}
|
|
|
- var plist []string
|
|
|
- if req.Intermediary != "" {
|
|
|
- plist = getIyProList(req.Intermediary, req.PositionId)
|
|
|
- }
|
|
|
- if req.PartyA == "" && len(plist) == 0 && req.Supplier == "" && req.Heterotophy == "" && req.Agency == "" {
|
|
|
+ dataMap := BuyerList(req.PartyA, req.Intermediary, req.PositionId)
|
|
|
+ if len(*dataMap) == 0 && req.Supplier == "" && req.Heterotophy == "" && req.Agency == "" {
|
|
|
return projectData
|
|
|
}
|
|
|
+ // 项目数量查询
|
|
|
+ buyerArr := getBuyerArr(dataMap)
|
|
|
//preSales := preSalesStatus(req.PositionId)
|
|
|
//isSqlPage := true
|
|
|
//if req.SaleStatus == "0" {
|
|
|
// isSqlPage = true // 是否sql分页
|
|
|
//}
|
|
|
- countSql, findSql, args := getQuerySql(req, plist, businessStr)
|
|
|
+ countSql, findSql, args := getQuerySql(req, buyerArr, businessStr)
|
|
|
// 缓存
|
|
|
rkey := fmt.Sprintf(NetworkManageProjectList, req.PositionId, common.GetMd5String(fmt.Sprintf("%+v", req)))
|
|
|
if ret, err := redis.GetNewBytes("newother", rkey); err == nil && ret != nil {
|
|
@@ -117,7 +116,7 @@ func GetProjectList(req *types.ProjectListReq) *ProjectData {
|
|
|
}
|
|
|
projectData.PList = resultList
|
|
|
projectData.Count = T.NetworkCom.Count(countSql, args...)
|
|
|
- moreInfo(req, plist, projectData.PList) // 补充信息
|
|
|
+ moreInfo(req, getIyProList(req.Intermediary, req.PositionId), projectData.PList) // 补充信息
|
|
|
redis.Put("newother", rkey, projectData, T.C.CacheTimeOut)
|
|
|
}
|
|
|
mmp := MonitorStatus(req.UserId) // 项目监控
|
|
@@ -147,6 +146,9 @@ func preSalesStatus(posid int64) (m1 map[string]interface{}) {
|
|
|
|
|
|
// 中间人 直接查询可介绍项目
|
|
|
func getIyProList(iy string, positionId int64) (array []string) {
|
|
|
+ if iy == "" {
|
|
|
+ return
|
|
|
+ }
|
|
|
wh, args := common.WhArgs(strings.Split(iy, ","))
|
|
|
args = append(args, positionId)
|
|
|
intermediaryArr := T.CrmMysql.SelectBySql(`select b.relate_id as relate_id,b.relate_name as relate_name from crm.connection a inner join crm.connection_introduce b on ( a.id in (`+wh+`) and a.position_id=? and a.id=b.connection_id and b.itype=2)`, args...)
|
|
@@ -161,16 +163,11 @@ func getQuerySql(req *types.ProjectListReq, plist []string, businessStr string)
|
|
|
countSql = "select count(1) from information.transaction_info_all a "
|
|
|
findSql = "select b.project_id as project_id,b.project_name as project_name,b.business_type as business_type,b.buyer as buyer,b.buyer_id as buyer_id,b.area as area,b.city as city,b.district as district,b.zbtime as zbtime,b.endtime as endtime,b.project_money as project_money,b.info_id as info_id,b.information_id as information_id,b.info_ids as info_ids from information.transaction_info_all a "
|
|
|
allArgs = []interface{}{}
|
|
|
- ors1 := []string{}
|
|
|
+ ors := []string{}
|
|
|
// 左侧选中的业主id
|
|
|
- if req.PartyA != "" {
|
|
|
- wh, args := common.WhArgs(strings.Split(req.PartyA, ","))
|
|
|
- ors1 = append(ors1, "a.buyer_id in ("+wh+")")
|
|
|
- allArgs = append(allArgs, args...)
|
|
|
- }
|
|
|
if len(plist) > 0 {
|
|
|
wh, args := common.WhArgs(plist)
|
|
|
- ors1 = append(ors1, "a.project_id in ("+wh+")")
|
|
|
+ ors = append(ors, "a.buyer_id in ("+wh+") and a.project_id=b.project_id")
|
|
|
allArgs = append(allArgs, args...)
|
|
|
}
|
|
|
ors2 := []string{}
|
|
@@ -191,10 +188,6 @@ func getQuerySql(req *types.ProjectListReq, plist []string, businessStr string)
|
|
|
ors2 = append(ors2, "a.agency_id in ("+wh+")")
|
|
|
allArgs = append(allArgs, args...)
|
|
|
}
|
|
|
- ors := []string{}
|
|
|
- if len(ors1) > 0 {
|
|
|
- ors = append(ors, "("+strings.Join(ors1, " or ")+") and a.project_id=b.project_id")
|
|
|
- }
|
|
|
if len(ors2) > 0 {
|
|
|
ors = append(ors, "("+strings.Join(ors2, " or ")+") and a.buyer_id<>'' and a.buyer_id=b.buyer_id")
|
|
|
}
|