فهرست منبع

Merge branch 'dev_v1.5.11_wh' of jianyu/datatools into feature/v1.5.11

王浩 1 سال پیش
والد
کامیت
4a777c1a89
1فایلهای تغییر یافته به همراه28 افزوده شده و 2 حذف شده
  1. 28 2
      clueSync/jobutil.go

+ 28 - 2
clueSync/jobutil.go

@@ -1032,6 +1032,9 @@ func autoDraw(mode, cluename, phone string, isGroup, isCommerce int) (positionId
 				if len(*cdata) > 1 {
 					//可能有多个人跟进
 					personMap := map[int64]bool{}
+					upperLimitPersonMap := map[int64]bool{}
+					upperLimitCdataNew := []map[string]interface{}{}
+					upperLimitCount := 0
 					for _, m := range *cdata {
 						positionid := gconv.Int64(m["position_id"])
 						for _, v := range *pdata {
@@ -1042,10 +1045,20 @@ func autoDraw(mode, cluename, phone string, isGroup, isCommerce int) (positionId
 										personMap[positionid] = true
 										m["saleName"] = common.ObjToString(v["name"])
 										cdataNew = append(cdataNew, m)
+									} else {
+										upperLimitCount++
+										upperLimitPersonMap[positionid] = true
+										m["saleName"] = common.ObjToString(v["name"])
+										upperLimitCdataNew = append(upperLimitCdataNew, m)
 									}
 								}
 							}
 						}
+						if len(cdataNew) == 0 && len(upperLimitCdataNew) > 0 {
+							//没有达上限的人数为0    全部都是达上限的
+							personMap = upperLimitPersonMap
+							cdataNew = upperLimitCdataNew
+						}
 					}
 					//查询是否都有没有离职
 					if len(personMap) != 0 && len(cdataNew) > 0 {
@@ -1088,6 +1101,7 @@ func autoDraw(mode, cluename, phone string, isGroup, isCommerce int) (positionId
 								return
 							} else {
 								count := 0
+								//线索数量判断
 								for i, v := range cdataNew {
 									if i == 0 {
 										count = gconv.Int(v["count"])
@@ -1098,13 +1112,18 @@ func autoDraw(mode, cluename, phone string, isGroup, isCommerce int) (positionId
 											data = v
 										}
 									}
-
 								}
-								//
 								positionId = common.Int64All(data["position_id"])
 								noticePositionId = positionId
 								saleName = common.ObjToString(data["saleName"])
 								seatNumber = common.ObjToString(data["seatNumber"])
+								if upperLimitCount == len(personMap) {
+									isFreeze = true
+									positionId = positionId
+									noticePositionId = 0
+									seatNumber = ""
+									saleName = ""
+								}
 								return
 							}
 						} else {
@@ -1112,6 +1131,13 @@ func autoDraw(mode, cluename, phone string, isGroup, isCommerce int) (positionId
 							noticePositionId = positionId
 							seatNumber = common.ObjToString(data["seatNumber"])
 							saleName = common.ObjToString(data["saleName"])
+							if upperLimitCount == len(personMap) {
+								isFreeze = true
+								positionId = 0
+								noticePositionId = positionId
+								seatNumber = ""
+								saleName = ""
+							}
 							return
 						}
 					}