WH01243 3 өдөр өмнө
parent
commit
0a0a359dc2

+ 34 - 1
clueSync/manualOperation.go

@@ -75,6 +75,19 @@ func clueBefore(c *gin.Context) {
 	}
 	top_cluetype, sub_cluetype, level, topname, subname := getCodeId(req.Action, req.SourceDesc)
 	seatNumber, saleName, saleData, pIsOk, isFreeze, noticePositionId := "", "", []map[string]interface{}{}, true, true, int64(0)
+	if uId == "" || phone == "" {
+		data := TiDb.FindOne("temporary_assignment", map[string]interface{}{
+			"userId": userId,
+			"status": 0,
+		}, "", "")
+		if data != nil && len(*data) > 0 {
+			positionId = gconv.Int64((*data)["positionId"])
+			returnData.Phone, returnData.Wxer, returnData.Name = GetPersonSubsidiary(positionId)
+			log.Println(returnData)
+			c.JSON(http.StatusOK, returnData)
+			return
+		}
+	}
 	if positionId != 0 {
 		//线索上边已经有人了
 		personnel := TiDb.FindOne("dwd_f_crm_personnel_management", map[string]interface{}{
@@ -319,7 +332,27 @@ func processUserInfo(in FetchDeptAdminRequest) (uId, userId, source, belong_to,
 		}, "", "")
 	}
 	if userMap == nil || len(*userMap) == 0 {
-		log.Println(in, "用户查询失败")
+		//查询用户原始表
+		userData := &[]map[string]interface{}{}
+		if mongodb.IsObjectIdHex(in.PositionId) {
+			userData, _ = Mgo.Find("user", map[string]interface{}{"_id": mongodb.StringTOBsonId(in.PositionId)}, ``, `{"_id":1,"s_phone":1,"s_m_phone":1}`, false, -1, -1)
+		} else {
+			sql := `select  b.id from  base_position   a    INNER JOIN   base_user   b   on     a.id  =? and  a.user_id=b.id`
+			baseData := Base.SelectBySql(sql, in.PositionId)
+			if baseData == nil || len(*baseData) == 0 {
+				return
+			}
+			userData, _ = Mgo.Find("user", map[string]interface{}{"base_user_id": gconv.Int64((*baseData)[0]["id"])}, ``, `{"_id":1,"s_phone":1,"s_m_phone":1}`, false, -1, -1)
+		}
+		if userData == nil || len(*userData) == 0 {
+			return
+		}
+		userId = mongodb.BsonIdToSId((*userData)[0]["_id"])
+		phone = gconv.String((*userData)[0]["s_phone"])
+		if phone == "" {
+			phone = gconv.String((*userData)[0]["s_m_phone"])
+		}
+		return
 	} else {
 		uId = gconv.String((*userMap)["uid"])
 		userId = gconv.String((*userMap)["userid"])