xuzhiheng пре 2 година
родитељ
комит
7dff3eed74
2 измењених фајлова са 22 додато и 14 уклоњено
  1. 21 13
      clueSync/job.go
  2. 1 1
      telemarketingEtl/entity/dwd_f_crm_open_sea.go

+ 21 - 13
clueSync/job.go

@@ -650,6 +650,9 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
 			clueUpdateData["position_id"] = positionId
 			clueUpdateData["comeintime"] = nowTime
 			clueUpdateData["is_assign"] = 1
+			clueUpdateData["comeinsource_open"] = nil
+			clueUpdateData["level_open"] = nil
+			clueUpdateData["clue_level"] = nil
 			// seaUpdateData["seatNumber"] = seatNumber
 			// seaUpdateData["position_id"] = positionId
 			// seaUpdateData["comeintime"] = nowTime
@@ -667,6 +670,9 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
 		clueUpdateData["seatNumber"] = old_seatNumber
 		clueUpdateData["position_id"] = old_position_id
 		clueUpdateData["is_assign"] = 1
+		clueUpdateData["comeinsource_open"] = nil
+		clueUpdateData["level_open"] = nil
+		clueUpdateData["clue_level"] = nil
 	}
 	if trailstatus != "08" && is_assign == 0 {
 		if trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400 {
@@ -778,7 +784,7 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
 			}
 		} else if trailstatus != "08" && is_assign == 0 {
 			if trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400 {
-			} else if trailstatus != "01" {
+			} else {
 				updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
 					"clue_id":      clueId,
 					"position_id":  positionId,
@@ -790,6 +796,19 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
 					"BCPCID":       common.GetRandom(32),
 					"operator_id":  -1,
 				})
+				if trailstatus != "01" {
+					updateId4 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
+						"clue_id":      clueId,
+						"position_id":  positionId,
+						"change_field": "trailstatus",
+						"change_type":  "基本信息变更",
+						"old_value":    CodeTrail[trailstatus],
+						"new_value":    "商机线索",
+						"createtime":   nowTime,
+						"BCPCID":       common.GetRandom(32),
+						"operator_id":  -1,
+					})
+				}
 				updateId3 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
 					"clue_id":      clueId,
 					"position_id":  positionId,
@@ -801,20 +820,9 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
 					"BCPCID":       common.GetRandom(32),
 					"operator_id":  -1,
 				})
-				updateId4 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
-					"clue_id":      clueId,
-					"position_id":  positionId,
-					"change_field": "trailstatus",
-					"change_type":  "基本信息变更",
-					"old_value":    CodeTrail[trailstatus],
-					"new_value":    "商机线索",
-					"createtime":   nowTime,
-					"BCPCID":       common.GetRandom(32),
-					"operator_id":  -1,
-				})
 			}
 		}
-		if trailstatus != "08" && recordCount <= 0 {
+		if (trailstatus != "08" && recordCount <= 0) || is_assign == 0 {
 			if trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400 {
 			} else {
 				updateId5 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{

+ 1 - 1
telemarketingEtl/entity/dwd_f_crm_open_sea.go

@@ -661,7 +661,7 @@ func GetOneSeaC(oneClassA, oneClassB map[string]bool) map[string]bool {
 			m[clueid] = true
 		}
 		return true
-	}, `select id from dwd_f_crm_clue_info where is_assign = 0 and comeinsource_open in(2,3,4)`)
+	}, `select id from dwd_f_crm_clue_info where is_assign = 0 and comeinsource_open in(3,4,5)`)
 	return m
 }