|
@@ -47,7 +47,9 @@ func rderAcceptance() {
|
|
|
product = gconv.String(v1["field_value"])
|
|
|
}
|
|
|
}
|
|
|
- WorkDataHandle(company, phone, demand, name, product, v)
|
|
|
+ if !WorkDataHandle(company, phone, demand, name, product, v) {
|
|
|
+ log.Println("工单创建失败")
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -63,6 +65,7 @@ func WorkDataHandle(company, phone, demand, name, product string, acceptanceData
|
|
|
}
|
|
|
}
|
|
|
if uId == "" {
|
|
|
+ log.Println("用户信息不存在")
|
|
|
return false
|
|
|
}
|
|
|
cluename := company
|
|
@@ -83,17 +86,17 @@ func WorkDataHandle(company, phone, demand, name, product string, acceptanceData
|
|
|
}
|
|
|
UpdateClue(*uCount, saleData, "", "", uId, "", "", "", "", company, name, gconv.String(data["name"]), phone, "", "", "", "", "", "", gconv.String(data["seat_number"]), "", gconv.Int64(data["position_id"]), "", "", "", []string{}, "", isGroup, isCommerce, true, demand)
|
|
|
} else {
|
|
|
- trailstatusl := gconv.String((*uCount)["trailstatusl"])
|
|
|
- if trailstatusl == "01" || trailstatusl == "03" || trailstatusl == "04" {
|
|
|
+ trailstatus := gconv.String((*uCount)["trailstatus"])
|
|
|
+ if trailstatus == "01" || trailstatus == "03" || trailstatus == "04" {
|
|
|
//变更销售员
|
|
|
ok, data, saleData = FindPosition(positionId, "", false)
|
|
|
if !ok {
|
|
|
return false
|
|
|
}
|
|
|
UpdateClue(*uCount, saleData, "", "", uId, "", "", "", "", company, name, gconv.String(data["name"]), phone, "", "", "", "", "", "", gconv.String(data["seat_number"]), "", gconv.Int64(data["position_id"]), "", "", "", []string{}, "", isGroup, isCommerce, true, demand)
|
|
|
- } else if trailstatusl == "08" {
|
|
|
+ } else if trailstatus == "08" {
|
|
|
//客成
|
|
|
- //查找客成人员标识
|
|
|
+ //生成客成数据
|
|
|
customerMap := TiDb.FindOne("dwd_f_csm_customer_info", map[string]interface{}{
|
|
|
"clue_id": clueId,
|
|
|
}, "position_id", "")
|
|
@@ -104,11 +107,23 @@ func WorkDataHandle(company, phone, demand, name, product string, acceptanceData
|
|
|
"position_id": (*customerMap)["position_id"],
|
|
|
"name": (*customerMap)["name"],
|
|
|
}
|
|
|
+ } else {
|
|
|
+ log.Println("查询不到客成数据", clueId, uId)
|
|
|
+ return false
|
|
|
}
|
|
|
-
|
|
|
+ TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
+ "clue_id": clueId,
|
|
|
+ "position_id": (*customerMap)["position_id"],
|
|
|
+ "change_type": "加入任务车",
|
|
|
+ "new_value": "工单创建",
|
|
|
+ "new_value_BAK": "工单创建",
|
|
|
+ "createtime": time.Now().Format(date.Date_Full_Layout),
|
|
|
+ "BCPCID": common.GetRandom(32),
|
|
|
+ "operator_id": -1,
|
|
|
+ })
|
|
|
} else {
|
|
|
//线索变更
|
|
|
- ok, data, saleData = FindPosition(positionId, trailstatusl, false)
|
|
|
+ ok, data, saleData = FindPosition(positionId, trailstatus, false)
|
|
|
if !ok {
|
|
|
return false
|
|
|
}
|
|
@@ -139,11 +154,15 @@ func AddOrderWork(acceptanceData map[string]interface{}, userData map[string]int
|
|
|
productArr = append(productArr, v)
|
|
|
}
|
|
|
}
|
|
|
+ two_type := "dx"
|
|
|
+ if gconv.String(userData["type"]) == "kc" {
|
|
|
+ two_type = "kc"
|
|
|
+ }
|
|
|
orderWorkMap := map[string]interface{}{
|
|
|
"work_order_no": work_order_no,
|
|
|
"acceptance_no": gconv.String(acceptanceData["acceptance_no"]),
|
|
|
"type": strings.Join(productArr, ","),
|
|
|
- "status": common.If(gconv.Int64(userData["orderStatus"]) == 0, 1, 2),
|
|
|
+ "status": common.If(gconv.Int64(userData["orderStatus"]) == 0, 2, 1),
|
|
|
"initiator_name": gconv.String(acceptanceData["creator_name"]),
|
|
|
"initiator_position_id": gconv.String(acceptanceData["initiator_position_id"]),
|
|
|
"current_name": userData["name"],
|
|
@@ -152,7 +171,7 @@ func AddOrderWork(acceptanceData map[string]interface{}, userData map[string]int
|
|
|
"creator_name": gconv.String(acceptanceData["creator_name"]),
|
|
|
"creator_position_id": gconv.String(acceptanceData["creator_position_id"]),
|
|
|
"creator_time": nowTime,
|
|
|
- "two_type": "dx",
|
|
|
+ "two_type": two_type,
|
|
|
"department_no": gconv.String(acceptanceData["department_no"]),
|
|
|
"department_name": gconv.String(acceptanceData["department_name"]),
|
|
|
}
|
|
@@ -258,7 +277,7 @@ func FindNumber(moudle string) string {
|
|
|
}
|
|
|
|
|
|
// 人员查询
|
|
|
-func FindPosition(positionId int64, trailstatusl string, full bool) (bool, map[string]interface{}, []map[string]interface{}) {
|
|
|
+func FindPosition(positionId int64, trailstatus string, full bool) (bool, map[string]interface{}, []map[string]interface{}) {
|
|
|
allData := []map[string]interface{}{}
|
|
|
//查询是否满了
|
|
|
if positionId != 0 {
|
|
@@ -353,7 +372,7 @@ FROM
|
|
|
if full {
|
|
|
switch positiontype {
|
|
|
case 1:
|
|
|
- if trailstatusl == "01" || trailstatusl == "03" || trailstatusl == "04" {
|
|
|
+ if trailstatus == "01" || trailstatus == "03" || trailstatus == "04" {
|
|
|
//找他上级
|
|
|
positionId1 := gconv.String(administrators1["position_id"])
|
|
|
administrators = administrators1
|
|
@@ -362,7 +381,7 @@ FROM
|
|
|
}
|
|
|
}
|
|
|
case 3:
|
|
|
- if trailstatusl == "01" || trailstatusl == "03" || trailstatusl == "04" {
|
|
|
+ if trailstatus == "01" || trailstatus == "03" || trailstatus == "04" {
|
|
|
//找他上级
|
|
|
positionId1 := gconv.String(administrators3["position_id"])
|
|
|
administrators = administrators3
|
|
@@ -391,6 +410,7 @@ FROM
|
|
|
} else {
|
|
|
return true, administrators1, allData
|
|
|
}
|
|
|
+ log.Println("电销信息获取失败", positionId)
|
|
|
return false, map[string]interface{}{}, allData
|
|
|
}
|
|
|
func CalculateProportion(positionIsStr string) float64 {
|
|
@@ -504,7 +524,7 @@ func users() {
|
|
|
ok1, ok2 := FormatData(v, "users")
|
|
|
if !ok1 {
|
|
|
common.WriteSysConfig(&cfg)
|
|
|
- log.Println("线索卡点", "users", v, selectTimeEnd)
|
|
|
+ log.Println("", "users", v, selectTimeEnd)
|
|
|
break
|
|
|
} else {
|
|
|
if !ok2 {
|