|
@@ -9,9 +9,6 @@ import (
|
|
|
)
|
|
|
|
|
|
var (
|
|
|
- WarningSize = 350
|
|
|
- LimitSize = 400
|
|
|
-
|
|
|
selfMail = `SELECT b.mail FROM jianyu.entniche_user b WHERE b.id IN (SELECT a.ent_user_id FROM Jianyu_subjectdb_test_test.dwd_d_crm_department_level_succbi a WHERE a.position_id = ?)`
|
|
|
infoSelf = `SELECT a.name, a.SZ_PID1, a.SZ_PID2, a.dept_name, b.role_id FROM Jianyu_subjectdb_test_test.dwd_d_crm_department_level_succbi a INNER JOIN Jianyu_subjectdb_test_test.dwd_f_crm_personnel_management b ON b.position_id = a.position_id WHERE a.position_id = ? AND a.resign = 0`
|
|
|
topMail = `SELECT d.mail FROM jianyu.entniche_user d WHERE d.id IN (SELECT b.ent_user_id FROM Jianyu_subjectdb_test.dwd_d_crm_department_level_succbi b INNER JOIN Jianyu_subjectdb_test.dwd_f_crm_personnel_management c
|
|
@@ -42,15 +39,15 @@ func WarningPerl() {
|
|
|
sendFlag2 := common.IntAll(m["flag_2"]) //上限邮件发送
|
|
|
posid := common.Int64All(m["position_id"])
|
|
|
count := Mysql.CountBySql(sql, posid)
|
|
|
- if count >= int64(WarningSize) && sendFlag1 == 0 {
|
|
|
+ if count >= int64(cfg.WarningValue) && sendFlag1 == 0 {
|
|
|
WillWarningByPp(posid) // 发预警邮件
|
|
|
_, _ = Mysql.ExecBySql(sql1, "send_mail | (1 << 0)", posid)
|
|
|
- } else if count >= int64(LimitSize) && sendFlag2 == 0 {
|
|
|
+ } else if count >= int64(cfg.AllocationCap) && sendFlag2 == 0 {
|
|
|
ExceedLimitByPp(posid) // 发上限邮件
|
|
|
_, _ = Mysql.ExecBySql(sql1, "send_mail | (1 << 1)", posid)
|
|
|
- } else if sendFlag1 == 1 && count < int64(WarningSize) { // 已发邮件
|
|
|
+ } else if sendFlag1 == 1 && count < int64(cfg.WarningValue) { // 已发邮件
|
|
|
_, _ = Mysql.ExecBySql(sql1, "send_mail & ~(1 << 0)", posid)
|
|
|
- } else if sendFlag2 == 1 && count < int64(LimitSize) { // 已发邮件
|
|
|
+ } else if sendFlag2 == 1 && count < int64(cfg.AllocationCap) { // 已发邮件
|
|
|
_, _ = Mysql.ExecBySql(sql1, "send_mail & ~(1 << 1)", posid)
|
|
|
}
|
|
|
}
|
|
@@ -67,11 +64,11 @@ func WarningDm() {
|
|
|
for _, m := range *dm {
|
|
|
d1 := common.ObjToString(m["dept_name"])
|
|
|
send1, send2 := true, true // 预警,上限 发送标记
|
|
|
- info := Mysql.SelectBySql(dmInfoCount, d1, WarningSize)
|
|
|
+ info := Mysql.SelectBySql(dmInfoCount, d1, cfg.WarningValue)
|
|
|
if info != nil && len(*info) > 0 {
|
|
|
send1 = false
|
|
|
}
|
|
|
- info1 := Mysql.SelectBySql(dmInfoCount, d1, LimitSize)
|
|
|
+ info1 := Mysql.SelectBySql(dmInfoCount, d1, cfg.AllocationCap)
|
|
|
if info1 != nil && len(*info1) > 0 {
|
|
|
send2 = false
|
|
|
}
|
|
@@ -139,7 +136,7 @@ func WillWarningByPp(posid int64) {
|
|
|
return
|
|
|
}
|
|
|
toCc = getCc(posid)
|
|
|
- content = fmt.Sprintf(content, WarningSize, LimitSize)
|
|
|
+ content = fmt.Sprintf(content, cfg.WarningValue, cfg.AllocationCap)
|
|
|
sendInfo(toMail, toCc, title, content)
|
|
|
}
|
|
|
|
|
@@ -150,7 +147,7 @@ func WillWarningByDm(dname, to string, toCc []string) {
|
|
|
title := "“%s”私海线索即将达到上限通知"
|
|
|
content := "“%s”的所有参与线索分配的电销人员,私海线索都已达到%d条(不包含成交客户),即将达到私海线索上限%d条(不包含成交客户),请及时通知电销人员将无需跟进的线索退回公海,以避免无法接收新线索。"
|
|
|
title = fmt.Sprintf(title, dname)
|
|
|
- content = fmt.Sprintf(content, dname, WarningSize, LimitSize)
|
|
|
+ content = fmt.Sprintf(content, dname, cfg.WarningValue, cfg.AllocationCap)
|
|
|
sendInfo(to, strings.Join(toCc, ","), title, content)
|
|
|
}
|
|
|
|
|
@@ -166,7 +163,7 @@ func WillWarningByAll() {
|
|
|
to = append(to, m3)
|
|
|
}
|
|
|
}
|
|
|
- content = fmt.Sprintf(content, WarningSize)
|
|
|
+ content = fmt.Sprintf(content, cfg.WarningValue)
|
|
|
sendInfo(strings.Join(to, ","), "", title, content)
|
|
|
}
|
|
|
|
|
@@ -179,7 +176,7 @@ func ExceedLimitByPp(posid int64) {
|
|
|
|
|
|
toMail := ""
|
|
|
toCc := ""
|
|
|
- content = fmt.Sprintf(content, LimitSize)
|
|
|
+ content = fmt.Sprintf(content, cfg.AllocationCap)
|
|
|
info := Mysql.SelectBySql(selfMail, posid)
|
|
|
if info != nil && len(*info) > 0 {
|
|
|
toMail = common.ObjToString((*info)[0]["mail"])
|
|
@@ -199,7 +196,7 @@ func ExceedLimitByDm(dname, to string, toCc []string) {
|
|
|
title := "“%s”私海线索已达到上限通知"
|
|
|
content := "“%s”的所有参与线索分配的电销人员,私海线索都已达到私海线索上限%d条(不包含成交客户),当前无法接收新线索,请及时通知电销人员将无需跟进的线索退回公海"
|
|
|
title = fmt.Sprintf(title, dname)
|
|
|
- content = fmt.Sprintf(content, dname, LimitSize)
|
|
|
+ content = fmt.Sprintf(content, dname, cfg.AllocationCap)
|
|
|
sendInfo(to, strings.Join(toCc, ","), title, content)
|
|
|
}
|
|
|
|
|
@@ -228,7 +225,7 @@ func AutoReleaseNots() {
|
|
|
}
|
|
|
}
|
|
|
toCc = append(toCc, "shenbingyi@topnet.net.cn")
|
|
|
- sendInfo(strings.Join(to, ","), strings.Join(toCc, ","), title, fmt.Sprintf(content, LimitSize))
|
|
|
+ sendInfo(strings.Join(to, ","), strings.Join(toCc, ","), title, fmt.Sprintf(content, cfg.AllocationCap))
|
|
|
}
|
|
|
|
|
|
// @Author jianghan
|
|
@@ -256,7 +253,7 @@ func CantBeAssignedNots() {
|
|
|
}
|
|
|
}
|
|
|
toCc = append(toCc, "shenbingyi@topnet.net.cn")
|
|
|
- sendInfo(strings.Join(to, ","), strings.Join(toCc, ","), title, fmt.Sprintf(content, LimitSize))
|
|
|
+ sendInfo(strings.Join(to, ","), strings.Join(toCc, ","), title, fmt.Sprintf(content, cfg.AllocationCap))
|
|
|
}
|
|
|
|
|
|
// @Author jianghan
|
|
@@ -280,7 +277,7 @@ func OrderCreateFail(posid int64, bname string) {
|
|
|
|
|
|
toMail := ""
|
|
|
toCc := ""
|
|
|
- content = fmt.Sprintf(content, LimitSize, LimitSize, bname)
|
|
|
+ content = fmt.Sprintf(content, cfg.AllocationCap, cfg.AllocationCap, bname)
|
|
|
info := Mysql.SelectBySql(selfMail, posid)
|
|
|
if info != nil && len(*info) > 0 {
|
|
|
toMail = common.ObjToString((*info)[0]["mail"])
|
|
@@ -302,7 +299,7 @@ func AssFail(posid int64, ent, iname string) {
|
|
|
|
|
|
toMail := ""
|
|
|
toCc := ""
|
|
|
- content = fmt.Sprintf(content, LimitSize, ent, iname)
|
|
|
+ content = fmt.Sprintf(content, cfg.AllocationCap, ent, iname)
|
|
|
info := Mysql.SelectBySql(selfMail, posid)
|
|
|
if info != nil && len(*info) > 0 {
|
|
|
toMail = common.ObjToString((*info)[0]["mail"])
|