|
@@ -18,7 +18,7 @@ var (
|
|
|
WHERE a.dept_name = '销售三部' AND a.resign = 0 AND c.role_id = 8`
|
|
|
dmInfo = `SELECT b.dept_name FROM dwd_d_crm_department_level_succbi b WHERE b.position_id IN (SELECT a.position_id FROM dwd_f_crm_personnel_management a
|
|
|
WHERE assign_type = 1) GROUP BY b.dept_name`
|
|
|
- dmInfoCount = `SELECT b.position_id, COUNT(IF(a.trailstatus <> '08', 1, NULL)) as num FROM dwd_f_crm_clue_info a RIGHT JOIN dwd_d_crm_department_level_succbi b ON a.position_id = b.position_id LEFT JOIN 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.is_transfer != 1, 1, NULL)) as num FROM dwd_f_crm_clue_info a RIGHT JOIN dwd_d_crm_department_level_succbi b ON a.position_id = b.position_id LEFT JOIN 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 = ?`
|
|
|
xgFlag = `SELECT a.name, (b.send_mail >> 4) & 1 AS flag 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`
|
|
|
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`
|
|
@@ -32,7 +32,7 @@ var (
|
|
|
// @Description 个人预警/上限
|
|
|
// @Date 2024/4/11
|
|
|
func WarningPerl() {
|
|
|
- sql := `SELECT count(*) FROM dwd_f_crm_clue_info where position_id = ? and trailstatus <> '08'`
|
|
|
+ sql := `SELECT count(*) FROM dwd_f_crm_clue_info where position_id = ? and is_transfer != 1`
|
|
|
sql1 := `UPDATE dwd_f_crm_personnel_management SET send_mail = (%s) where position_id = ?`
|
|
|
pp := TiDb.SelectBySql(`SELECT name, position_id, send_mail & 1 AS flag_1, (send_mail >> 1) & 1 AS flag_2 FROM dwd_f_crm_personnel_management WHERE resign = 0`)
|
|
|
if pp != nil && len(*pp) > 0 {
|
|
@@ -60,7 +60,7 @@ func WarningPerl() {
|
|
|
// @Description 部门预警/上限 所有人
|
|
|
// @Date 2024/5/9
|
|
|
func WarningDm() {
|
|
|
- sql1 := `UPDATE dwd_f_crm_personnel_management SET send_mail = (%s) where position_id = ?`
|
|
|
+ sql1 := `UPDATE dwd_f_crm_personnel_management SET send_mail = (%s) where position_id = ? `
|
|
|
dm := TiDb.SelectBySql(dmInfo)
|
|
|
send := true // 所有人
|
|
|
for _, m := range *dm {
|