|
@@ -19,6 +19,7 @@ var (
|
|
WHERE assign_type = 1) GROUP BY b.dept_name`
|
|
WHERE assign_type = 1) GROUP BY b.dept_name`
|
|
dmInfoCount = `SELECT b.position_id, COUNT(IF(a.trailstatus <> '08', 1, NULL)) as num FROM Jianyu_subjectdb_test.dwd_f_crm_clue_info a RIGHT JOIN Jianyu_subjectdb_test.dwd_d_crm_department_level_succbi b ON a.position_id = b.position_id LEFT JOIN Jianyu_subjectdb_test.dwd_f_crm_personnel_management c ON b.position_id = c.position_id WHERE b.dept_name = ? AND c.resign = 0 AND c.assign_type = 1 GROUP BY a.position_id HAVING num < ?`
|
|
dmInfoCount = `SELECT b.position_id, COUNT(IF(a.trailstatus <> '08', 1, NULL)) as num FROM Jianyu_subjectdb_test.dwd_f_crm_clue_info a RIGHT JOIN Jianyu_subjectdb_test.dwd_d_crm_department_level_succbi b ON a.position_id = b.position_id LEFT JOIN Jianyu_subjectdb_test.dwd_f_crm_personnel_management c ON b.position_id = c.position_id WHERE b.dept_name = ? AND c.resign = 0 AND c.assign_type = 1 GROUP BY a.position_id HAVING num < ?`
|
|
dmInfoMail = `SELECT a.name, a.position_id, (b.send_mail >> 2) & 1 AS flag_1, (b.send_mail >> 3) & 1 AS flag_2, c.mail FROM dwd_d_crm_department_level_succbi a INNER JOIN dwd_f_crm_personnel_management b ON a.position_id = b.position_id LEFT JOIN jianyu.entniche_user c ON a.ent_user_id = c.id WHERE a.dept_name = ? AND a.resign = 0 AND b.role_id = 3`
|
|
dmInfoMail = `SELECT a.name, a.position_id, (b.send_mail >> 2) & 1 AS flag_1, (b.send_mail >> 3) & 1 AS flag_2, c.mail FROM dwd_d_crm_department_level_succbi a INNER JOIN dwd_f_crm_personnel_management b ON a.position_id = b.position_id LEFT JOIN jianyu.entniche_user c ON a.ent_user_id = c.id WHERE a.dept_name = ? AND a.resign = 0 AND b.role_id = 3`
|
|
|
|
+ xgFlag = `SELECT a.name, (b.send_mail >> 4) & 1 AS flag FROM dwd_d_crm_department_level_succbi a INNER JOIN jianyu_subjectdb_test.dwd_f_crm_personnel_management b ON a.position_id = b.position_id WHERE b.role_id = 5 AND b.resign = 0`
|
|
xgMail = `SELECT a.name, c.mail FROM dwd_d_crm_department_level_succbi a INNER JOIN dwd_f_crm_personnel_management b ON a.position_id = b.position_id LEFT JOIN jianyu.entniche_user c ON a.ent_user_id = c.id WHERE b.role_id = 5 AND b.resign = 0`
|
|
xgMail = `SELECT a.name, c.mail FROM dwd_d_crm_department_level_succbi a INNER JOIN dwd_f_crm_personnel_management b ON a.position_id = b.position_id LEFT JOIN jianyu.entniche_user c ON a.ent_user_id = c.id WHERE b.role_id = 5 AND b.resign = 0`
|
|
// 所有参与线索分配人员的邮箱
|
|
// 所有参与线索分配人员的邮箱
|
|
allMail = `SELECT a.name, c.mail FROM dwd_f_crm_personnel_management a INNER JOIN dwd_d_crm_department_level_succbi b ON a.position_id = b.position_id LEFT JOIN jianyu.entniche_user c ON b.ent_user_id = c.id WHERE a.assign_type = 1 AND a.resign = 0`
|
|
allMail = `SELECT a.name, c.mail FROM dwd_f_crm_personnel_management a INNER JOIN dwd_d_crm_department_level_succbi b ON a.position_id = b.position_id LEFT JOIN jianyu.entniche_user c ON b.ent_user_id = c.id WHERE a.assign_type = 1 AND a.resign = 0`
|
|
@@ -119,7 +120,16 @@ func WarningDm() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if send {
|
|
if send {
|
|
- WillWarningByAll()
|
|
|
|
|
|
+ info3 := TiDb.SelectBySql(xgFlag)
|
|
|
|
+ if info3 != nil && len(*info3) > 0 {
|
|
|
|
+ sendFlag := common.IntAll((*info3)[0]["flag_1"])
|
|
|
|
+ if sendFlag == 0 {
|
|
|
|
+ WillWarningByAll()
|
|
|
|
+ } else {
|
|
|
|
+ sql := `UPDATE jianyu_subjectdb_test.dwd_f_crm_personnel_management SET send_mail = (send_mail | (1 << 4)) where position_id IN (SELECT a.position_id FROM dwd_d_crm_department_level_succbi a INNER JOIN dwd_f_crm_personnel_management b ON a.position_id = b.position_id WHERE b.role_id = 5 AND b.resign = 0)`
|
|
|
|
+ TiDb.ExecBySql(sql) // 修改销管 发送邮件标志 0
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|