|
@@ -356,6 +356,32 @@ func kcJob(data map[string]interface{}) int {
|
|
return status
|
|
return status
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 新增客成变更记录
|
|
|
|
+func addKChangeRecord(clueId, positionId int64, oldName, newName string) {
|
|
|
|
+ nowTime := time.Now().Format(date.Date_Full_Layout)
|
|
|
|
+ //进客成记录
|
|
|
|
+ TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
+ "clue_id": clueId,
|
|
|
|
+ "position_id": positionId,
|
|
|
|
+ "change_type": "成交客户移交",
|
|
|
|
+ "new_value": "移交至客户成功组",
|
|
|
|
+ "createtime": nowTime,
|
|
|
|
+ "BCPCID": common.GetRandom(32),
|
|
|
|
+ "operator_id": -1,
|
|
|
|
+ })
|
|
|
|
+ TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
+ "clue_id": clueId,
|
|
|
|
+ "position_id": positionId,
|
|
|
|
+ "change_field": "position_id",
|
|
|
|
+ "change_type": "客户成功经理",
|
|
|
|
+ "old_value": common.If(oldName != newName, oldName, common.If(oldName == "", "/", oldName)),
|
|
|
|
+ "new_value": newName,
|
|
|
|
+ "createtime": nowTime,
|
|
|
|
+ "BCPCID": common.GetRandom(32),
|
|
|
|
+ "operator_id": -1,
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
// 客成人员查询
|
|
// 客成人员查询
|
|
func cAutoDraw(entId int, orderPositionId int64, salesperson, saleDep string, customData *map[string]interface{}, company_name string) (positionId int64, name string) {
|
|
func cAutoDraw(entId int, orderPositionId int64, salesperson, saleDep string, customData *map[string]interface{}, company_name string) (positionId int64, name string) {
|
|
if customData != nil {
|
|
if customData != nil {
|
|
@@ -2043,3 +2069,39 @@ func getOrderData(sql string) (map[string]map[string]interface{}, string) {
|
|
|
|
|
|
return orderMap, lastEndTime
|
|
return orderMap, lastEndTime
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// 客成移交 其他相对应的数据也移交
|
|
|
|
+func OtherKcTransfer(uid, kcName, companyName, productName string, kcPositionId, entId int64) {
|
|
|
|
+ //查找子账号
|
|
|
|
+ if entId == 0 {
|
|
|
|
+ //个人账号
|
|
|
|
+ userData := TiDb.FindOne("data_service.user_system", map[string]interface{}{
|
|
|
|
+ "status": 1,
|
|
|
|
+ "uid": uid,
|
|
|
|
+ }, "", "createtime DESC ")
|
|
|
|
+ if userData == nil || len(*userData) == 0 {
|
|
|
|
+ log.Println(fmt.Sprintf("查询不到 %s 用户信息", uid))
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ mongoId := gconv.String((*userData)["userid"])
|
|
|
|
+ //子账号
|
|
|
|
+ query := map[string]interface{}{"s_member_mainid": mongoId}
|
|
|
|
+ childAccount, _ := Mgo.Find("user", query, "", `"_id":1`, false, -1, -1)
|
|
|
|
+ if childAccount == nil || len(*childAccount) == 0 {
|
|
|
|
+ log.Println(fmt.Sprintf("子账号查询不到 %s , %s 用户信息", uid, mongoId))
|
|
|
|
+ }
|
|
|
|
+ childIds := []string{}
|
|
|
|
+ log.Println(fmt.Sprintf("子账号 %s , %s , 数量 %v ", uid, mongoId, len(*childAccount)))
|
|
|
|
+ for _, v := range *childAccount {
|
|
|
|
+ childIds = append(childIds, mongodb.BsonIdToSId(v["_id"]))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //企业订单
|
|
|
|
+ //企业下人员查询
|
|
|
|
+ switch productName {
|
|
|
|
+ case "商机管理":
|
|
|
|
+ case "大会员":
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|