Эх сурвалжийг харах

客成销售人员查询处理

WH01243 3 сар өмнө
parent
commit
9e7575ffff
1 өөрчлөгдсөн 16 нэмэгдсэн , 23 устгасан
  1. 16 23
      clueSync/kc.go

+ 16 - 23
clueSync/kc.go

@@ -955,15 +955,8 @@ func refundAuto() {
 							}
 						} else if saleId == 0 {
 							//找不到人
-							if oldSaleId == 0 {
-								//一直没有人不需要做处理
-								if isFull {
-									TiDb.UpdateOrDeleteBySql(`UPDATE dwd_f_crm_clue_info SET is_unfollow=0,updatetime=?,trailstatus="01",top_cluetype="532",sub_cluetype="537",is_transfer=0,is_assign=-3,FREEZE_TIME=? WHERE id = ?`, nowTime, nowTime, clueId)
-								} else {
-									TiDb.UpdateOrDeleteBySql(`UPDATE dwd_f_crm_clue_info SET is_unfollow=0,updatetime=?,trailstatus="01",top_cluetype="532",sub_cluetype="537",is_transfer=0,is_assign=0 WHERE id = ?`, nowTime, clueId)
-								}
-							} else {
-								//变得没有人了
+							TiDb.UpdateOrDeleteBySql(`UPDATE dwd_f_crm_clue_info SET is_unfollow=0,updatetime=?,trailstatus="01",position_id="",seatNumber="",is_task=1,tasktime=?,top_cluetype="532",sub_cluetype="537",taskstatus=0,tasksource="其他-成交客户续约失败",is_transfer=0,is_assign=0 WHERE id = ?`, nowTime, nowTime, clueId)
+							if oldSaleId != 0 {
 								//新增个人员变更
 								TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
 									"clue_id":      clueId,
@@ -975,12 +968,10 @@ func refundAuto() {
 									"createtime":   nowTime,
 									"BCPCID":       common.GetRandom(32),
 									"operator_id":  -1,
+									"SHUOMING":     "业绩归属查不到人",
 								})
 								//再做一个记录变更
-								TiDb.UpdateOrDeleteBySql(`UPDATE dwd_f_crm_clue_info SET is_unfollow=0,updatetime=?,trailstatus="01",position_id=?,seatNumber=?,is_task=1,tasktime=?,top_cluetype="532",sub_cluetype="537",taskstatus=0,tasksource="其他-成交客户续约失败",is_transfer=0,is_assign=0 WHERE id = ?`, nowTime, saleId, newSeatNumber, nowTime, clueId)
-
 							}
-
 						}
 						TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
 							"clue_id":      clueId,
@@ -993,15 +984,17 @@ func refundAuto() {
 							"BCPCID":       common.GetRandom(32),
 							"operator_id":  -1,
 						})
-						TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
-							"clue_id":     clueId,
-							"position_id": saleId,
-							"change_type": "加入任务车",
-							"new_value":   "线索自动分配-其他-成交客户续约失败",
-							"createtime":  nowTime,
-							"BCPCID":      common.GetRandom(32),
-							"operator_id": -1,
-						})
+						if saleId > 0 {
+							TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
+								"clue_id":     clueId,
+								"position_id": saleId,
+								"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":  common.If(kcposition_id > 0, kcposition_id, -1),
@@ -1057,7 +1050,7 @@ func refundAuto() {
 		}
 		return true
 	}, `select ent_id,clue_id,position_id,name,is_renewal_protection,company_name from dwd_f_csm_customer_info where is_transfer = 0`)
-	//}, `select ent_id,clue_id,position_id,name,is_renewal_protection,company_name from dwd_f_csm_customer_info where clue_id =1490510`)
+	//}, `select ent_id,clue_id,position_id,name,is_renewal_protection,company_name from dwd_f_csm_customer_info where clue_id =1441420`)
 
 	//移交电销提醒
 	for i, v := range mailData {
@@ -1910,7 +1903,7 @@ func SaleMail(positionId int64) string {
 }
 func FindPersonOne(positionId int64) map[string]interface{} {
 	personData := TiDb.SelectBySql(`SELECT
-											b.NAME,
+											b.name,
 											b.position_id,
 											b.seat_number,
 											b.role_id,