WH01243 7 сар өмнө
parent
commit
de54f4022a
2 өөрчлөгдсөн 29 нэмэгдсэн , 33 устгасан
  1. 20 28
      service/clue.go
  2. 9 5
      service/company.go

+ 20 - 28
service/clue.go

@@ -762,10 +762,9 @@ func batchDraw(data []map[string]interface{}, nowTime, seatNumber, name string,
 				"operator_id":  positionId,
 			})
 			//标签处理
-			labelChangeTime := gconv.String(v["labelChangeTime"])
 			label := gconv.Int64(v["label"])
 			trailstatusCode := gconv.String(v["trailstatus"])
-			LabelHandel(tx, label, 3, clueId, "", "01", trailstatusCode, labelChangeTime)
+			LabelHandel(tx, label, 3, clueId, "", "01", trailstatusCode, name, "/", 0)
 			return ok1 && recordId > 0 && recordId1 > 0 && recordId2 > 0 && recordId3 > -1 && recordId4 > -1
 		}) {
 			logx.Info("领取线索成功")
@@ -1089,6 +1088,7 @@ func ClueImportSync(this *biservice.ClueImportReq) (string, int) {
 							}
 							if sub_cluetype != "" && sub_cluetype != old_sub_cluetype {
 								updateData["position"] = position
+								taskstatus := gconv.Int64((*clueData)["taskstatus"])
 								JyBiTidb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
 									"clue_id":      clueId,
 									"position_id":  -1,
@@ -1100,7 +1100,7 @@ func ClueImportSync(this *biservice.ClueImportReq) (string, int) {
 									"BCPCID":       common.GetRandom(32),
 									"operator_id":  this.PositionId,
 								})
-								LabelHandel(nil, label, 2, clueId, level, trailstatusCode, trailstatusCode, labelChangeTime)
+								LabelHandel(nil, label, 2, clueId, level, trailstatusCode, trailstatusCode, "", "", taskstatus)
 							}
 							JyBiTidb.Update("dwd_f_crm_clue_info", map[string]interface{}{"id": clueId}, updateData)
 						} else if is_assign == 1 {
@@ -1176,7 +1176,8 @@ func ClueImportSync(this *biservice.ClueImportReq) (string, int) {
 									"BCPCID":       common.GetRandom(32),
 									"operator_id":  this.PositionId,
 								})
-								LabelHandel(nil, label, 2, positionId, level, trailstatusCode, trailstatusCode, labelChangeTime)
+								taskstatus := gconv.Int64((*clueData)["taskstatus"])
+								LabelHandel(nil, label, 2, positionId, level, trailstatusCode, trailstatusCode, "", "", taskstatus)
 							}
 							if sub_cluetype != "" && sub_cluetype != old_sub_cluetype {
 								updateData["position"] = position
@@ -1273,45 +1274,36 @@ func FindClueInfo(in *biservice.FindClueInfoReq) (map[string]interface{}, int64)
 }
 
 // 线索标签修改 label  labelChangeTime
-func LabelHandel(tx *sql.Tx, oldlabelType, labelType, clueId int64, level, oldTrailstatusCode, trailstatusCode, labelChangeTime string) {
-	log.Println("线索标签修改:", oldlabelType, labelType, clueId, level, trailstatusCode, labelChangeTime)
+func LabelHandel(tx *sql.Tx, oldlabelType, labelType, clueId int64, level, oldTrailstatusCode, trailstatusCode, name, oldName string, status int64) {
+	log.Println("线索标签修改:", "oldlabelType:", oldlabelType, "labelType:", labelType, "clueId:", clueId, "level:", level, "oldTrailstatusCode:", oldTrailstatusCode, "trailstatusCode:", trailstatusCode, "status:", status)
 	//先查询以前什么类型
 	if trailstatusCode != "01" && oldTrailstatusCode != "01" {
+		log.Println("不属于商机类型", clueId)
+		return
+	}
+	if status != 0 {
+		log.Println("不属于未完成", clueId)
 		return
 	}
 	updateLabelType := int64(0)
 	nowStr := time.Now().Format("2006-01-02")
-	if labelType == 1 {
-		//直接更新
-		if labelChangeTime == nowStr {
-			if oldlabelType != 1 {
-				updateLabelType = labelType
-			}
-		} else {
-			updateLabelType = labelType
-		}
-	} else if labelType == 2 {
+	if labelType == 2 {
 		if level != "A" && level != "B" && level != "C" {
 			return
 		}
 		//查询以前是什么数据
-		if labelChangeTime == nowStr {
-			//同一天修改过
-			if oldlabelType != 1 {
-				updateLabelType = labelType
-			}
-		} else {
+		//人员变更
+		if oldlabelType != 1 {
 			updateLabelType = labelType
 		}
 	} else {
 		//查询以前是什么数据
-		if labelChangeTime == nowStr {
-			//同一天修改过
-			if oldlabelType != 3 {
-				updateLabelType = oldlabelType
+		if oldName != name {
+			if oldlabelType == 1 {
+				updateLabelType = 1
+			} else {
+				updateLabelType = 3
 			}
-		} else {
-			updateLabelType = labelType
 		}
 	}
 	if updateLabelType > 0 {

+ 9 - 5
service/company.go

@@ -263,11 +263,12 @@ func dclue(v, positionId, isTask, thispositionId int64) {
 					"operator_id":  thispositionId,
 				})
 				//标签变更
-				labelChangeTime := gconv.String((*clueData)["labelChangeTime"])
 				label := gconv.Int64((*clueData)["label"])
-				if oldName != name {
-					LabelHandel(nil, label, 3, v, "", trailstatus, trailstatus, labelChangeTime)
+				taskstatus := gconv.Int64(updateClue["taskstatus"])
+				if isTask == int64(1) {
+					taskstatus = 0
 				}
+				LabelHandel(nil, label, 3, v, "", trailstatus, trailstatus, name, oldName, taskstatus)
 				JyBiTidb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
 					"clue_id":      v,
 					"position_id":  oldpositionId,
@@ -341,9 +342,12 @@ func dclue(v, positionId, isTask, thispositionId int64) {
 					"BCPCID":       common.GetRandom(32),
 					"operator_id":  thispositionId,
 				})
-				labelChangeTime := gconv.String((*clueData)["labelChangeTime"])
 				label := gconv.Int64((*clueData)["label"])
-				LabelHandel(nil, label, 3, v, "", "01", trailstatus, labelChangeTime)
+				taskstatus := gconv.Int64(updateClue["taskstatus"])
+				if isTask == int64(1) {
+					taskstatus = 0
+				}
+				LabelHandel(nil, label, 3, v, "", "01", trailstatus, name, "/", taskstatus)
 				JyBiTidb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
 					"clue_id":      v,
 					"position_id":  positionId,