|
@@ -12,52 +12,52 @@ func autoTask() {
|
|
|
log.Println("超时未跟进定时任务开始")
|
|
|
t := time.Now()
|
|
|
nowTime := time.Now().Format(date.Date_Full_Layout)
|
|
|
- statusMap := map[string]int{
|
|
|
- "07": 5, //待签署客户
|
|
|
- "06": 3, //高意向客户
|
|
|
- "05": 5, //意向客户
|
|
|
- "04": 7, //潜在客户
|
|
|
- }
|
|
|
+ // statusMap := map[string]int{
|
|
|
+ // "07": 5, //待签署客户
|
|
|
+ // "06": 3, //高意向客户
|
|
|
+ // "05": 5, //意向客户
|
|
|
+ // "04": 7, //潜在客户
|
|
|
+ // }
|
|
|
// statusMaps := map[string]int{}
|
|
|
//判断节假日
|
|
|
- for status, statusInt := range statusMap {
|
|
|
- count, counts := 0, 0
|
|
|
- for {
|
|
|
- count++
|
|
|
- currentTime := t.AddDate(0, 0, -count)
|
|
|
- if currentTime.Weekday() == time.Sunday || currentTime.Weekday() == time.Saturday {
|
|
|
- isok := false
|
|
|
- for k, v := range DateMap {
|
|
|
- if currentTime.Format(date.Date_Short_Layout) == k && v == 2 {
|
|
|
- isok = true
|
|
|
- }
|
|
|
- }
|
|
|
- if isok {
|
|
|
- counts++
|
|
|
- }
|
|
|
- } else {
|
|
|
- isok := true
|
|
|
- for k, v := range DateMap {
|
|
|
- if currentTime.Format(date.Date_Short_Layout) == k && v == 1 {
|
|
|
- isok = false
|
|
|
- }
|
|
|
- }
|
|
|
- if isok {
|
|
|
- counts++
|
|
|
- }
|
|
|
- }
|
|
|
- if counts >= statusInt {
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- statusMap[status] = count
|
|
|
- }
|
|
|
- log.Println(statusMap)
|
|
|
- for trailstatus, _ := range map[string]string{
|
|
|
- "07": "", //待签署客户
|
|
|
- "06": "", //高意向客户
|
|
|
- "05": "", //意向客户
|
|
|
- "04": "", //潜在客户
|
|
|
+ // for status, statusInt := range statusMap {
|
|
|
+ // count, counts := 0, 0
|
|
|
+ // for {
|
|
|
+ // count++
|
|
|
+ // currentTime := t.AddDate(0, 0, -count)
|
|
|
+ // if currentTime.Weekday() == time.Sunday || currentTime.Weekday() == time.Saturday {
|
|
|
+ // isok := false
|
|
|
+ // for k, v := range DateMap {
|
|
|
+ // if currentTime.Format(date.Date_Short_Layout) == k && v == 2 {
|
|
|
+ // isok = true
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if isok {
|
|
|
+ // counts++
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // isok := true
|
|
|
+ // for k, v := range DateMap {
|
|
|
+ // if currentTime.Format(date.Date_Short_Layout) == k && v == 1 {
|
|
|
+ // isok = false
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if isok {
|
|
|
+ // counts++
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if counts >= statusInt {
|
|
|
+ // break
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // statusMap[status] = count
|
|
|
+ // }
|
|
|
+ // log.Println(statusMap)
|
|
|
+ for trailstatus, nexttime := range map[string]interface{}{
|
|
|
+ "07": t.AddDate(0, 0, -5), //待签署客户
|
|
|
+ "06": t.AddDate(0, 0, -3), //高意向客户
|
|
|
+ "05": t.AddDate(0, 0, -5), //意向客户
|
|
|
+ "04": t.AddDate(0, 0, -7), //潜在客户
|
|
|
} {
|
|
|
sql := `SELECT a.clue_id,a.position_id,a.seatNumber,a.out_task_status FROM dwd_f_crm_private_sea a
|
|
|
LEFT JOIN dwd_f_crm_clue_info b ON a.clue_id=b.id
|
|
@@ -65,7 +65,8 @@ func autoTask() {
|
|
|
argsSelect := []interface{}{trailstatus}
|
|
|
intime := ""
|
|
|
sql += " AND a.comeintime <?"
|
|
|
- nt := t.AddDate(0, 0, -statusMap[trailstatus])
|
|
|
+ nt := nexttime.(time.Time)
|
|
|
+ // nt := t.AddDate(0, 0, -statusMap[trailstatus])
|
|
|
intime = nt.Format(date.Date_Full_Layout)
|
|
|
argsSelect = append(argsSelect, intime)
|
|
|
//
|
|
@@ -80,14 +81,15 @@ func autoTask() {
|
|
|
sql2 := `SELECT COUNT(1) FROM dwd_f_crm_trail_content WHERE clue_id = ? and position_id = ?`
|
|
|
if intime != "" {
|
|
|
sql2 += ` and createtime > ?`
|
|
|
- args2 = append(args2, intime)
|
|
|
args2 = append(args2, position_id)
|
|
|
+ args2 = append(args2, intime)
|
|
|
}
|
|
|
//保留未跟进线索
|
|
|
// if c1, c2 := TiDb.CountBySql(sql1, clueId), TiDb.CountBySql(sql2, args2...); (c1 != 0 && c2 > 0) || out_task_status == 1 {
|
|
|
// log.Println("不满足线索过滤", clueId)
|
|
|
// continue
|
|
|
// }
|
|
|
+ log.Println("intime ", clueId, intime, sql2)
|
|
|
if c2 := TiDb.CountBySql(sql2, args2...); c2 > 0 || out_task_status == 1 {
|
|
|
log.Println("不满足线索过滤", clueId)
|
|
|
continue
|