|
@@ -9,7 +9,7 @@ import (
|
|
)
|
|
)
|
|
|
|
|
|
var (
|
|
var (
|
|
- 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 = ?)`
|
|
|
|
|
|
+ selfMail = `SELECT b.mail FROM jianyu.entniche_user b WHERE b.id IN (SELECT a.ent_user_id FROM Jianyu_subjectdb_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`
|
|
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
|
|
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
|
|
ON b.position_id = c.position_id AND c.resign = 0 WHERE b.SZ_PID3 IN (SELECT a.SZ_PID3 FROM Jianyu_subjectdb_test.dwd_d_crm_department_level_succbi a WHERE a.position_id = ?) AND c.role_id = 3)`
|
|
ON b.position_id = c.position_id AND c.resign = 0 WHERE b.SZ_PID3 IN (SELECT a.SZ_PID3 FROM Jianyu_subjectdb_test.dwd_d_crm_department_level_succbi a WHERE a.position_id = ?) AND c.role_id = 3)`
|
|
@@ -127,10 +127,7 @@ func WillWarningByPp(posid int64) {
|
|
toMail := ""
|
|
toMail := ""
|
|
toCc := ""
|
|
toCc := ""
|
|
|
|
|
|
- info := TiDb.SelectBySql(selfMail, posid)
|
|
|
|
- if info != nil && len(*info) > 0 {
|
|
|
|
- toMail = common.ObjToString((*info)[0]["mail"])
|
|
|
|
- }
|
|
|
|
|
|
+ toMail = getMailAds(posid)
|
|
if toMail == "" {
|
|
if toMail == "" {
|
|
log.Println("未查询到邮箱地址, position id: ", posid)
|
|
log.Println("未查询到邮箱地址, position id: ", posid)
|
|
return
|
|
return
|
|
@@ -177,10 +174,7 @@ func ExceedLimitByPp(posid int64) {
|
|
toMail := ""
|
|
toMail := ""
|
|
toCc := ""
|
|
toCc := ""
|
|
content = fmt.Sprintf(content, cfg.AllocationCap)
|
|
content = fmt.Sprintf(content, cfg.AllocationCap)
|
|
- info := TiDb.SelectBySql(selfMail, posid)
|
|
|
|
- if info != nil && len(*info) > 0 {
|
|
|
|
- toMail = common.ObjToString((*info)[0]["mail"])
|
|
|
|
- }
|
|
|
|
|
|
+ toMail = getMailAds(posid)
|
|
if toMail == "" {
|
|
if toMail == "" {
|
|
log.Println("未查询到邮箱地址, position id: ", posid)
|
|
log.Println("未查询到邮箱地址, position id: ", posid)
|
|
return
|
|
return
|
|
@@ -278,10 +272,7 @@ func OrderCreateFail(posid int64, bname string) {
|
|
toMail := ""
|
|
toMail := ""
|
|
toCc := ""
|
|
toCc := ""
|
|
content = fmt.Sprintf(content, cfg.AllocationCap, cfg.AllocationCap, bname)
|
|
content = fmt.Sprintf(content, cfg.AllocationCap, cfg.AllocationCap, bname)
|
|
- info := TiDb.SelectBySql(selfMail, posid)
|
|
|
|
- if info != nil && len(*info) > 0 {
|
|
|
|
- toMail = common.ObjToString((*info)[0]["mail"])
|
|
|
|
- }
|
|
|
|
|
|
+ toMail = getMailAds(posid)
|
|
if toMail == "" {
|
|
if toMail == "" {
|
|
log.Println("未查询到邮箱地址, position id: ", posid)
|
|
log.Println("未查询到邮箱地址, position id: ", posid)
|
|
return
|
|
return
|
|
@@ -300,10 +291,7 @@ func AssFail(posid int64, ent, iname string) {
|
|
toMail := ""
|
|
toMail := ""
|
|
toCc := ""
|
|
toCc := ""
|
|
content = fmt.Sprintf(content, cfg.AllocationCap, ent, iname)
|
|
content = fmt.Sprintf(content, cfg.AllocationCap, ent, iname)
|
|
- info := TiDb.SelectBySql(selfMail, posid)
|
|
|
|
- if info != nil && len(*info) > 0 {
|
|
|
|
- toMail = common.ObjToString((*info)[0]["mail"])
|
|
|
|
- }
|
|
|
|
|
|
+ toMail = getMailAds(posid)
|
|
if toMail == "" {
|
|
if toMail == "" {
|
|
log.Println("未查询到邮箱地址, position id: ", posid)
|
|
log.Println("未查询到邮箱地址, position id: ", posid)
|
|
return
|
|
return
|
|
@@ -363,3 +351,20 @@ func getCc(posid int64) (to string) {
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// @Author jianghan
|
|
|
|
+// @Description 获取邮箱地址
|
|
|
|
+// @Date 2024/5/13
|
|
|
|
+func getMailAds(posid int64) string {
|
|
|
|
+ sql := `SELECT a.ent_user_id FROM Jianyu_subjectdb_test.dwd_d_crm_department_level_succbi a WHERE a.position_id = ?`
|
|
|
|
+ sql1 := `SELECT mail FROM jianyu.entniche_user WHERE id = ?`
|
|
|
|
+ info := TiDb.SelectBySql(sql, posid)
|
|
|
|
+ if info != nil && len(*info) > 0 {
|
|
|
|
+ id := common.Int64All((*info)[0]["ent_user_id"])
|
|
|
|
+ info1 := Mysql.SelectBySql(sql1, id)
|
|
|
|
+ if info1 != nil && len(*info1) > 0 {
|
|
|
|
+ return common.ObjToString((*info1)[0]["mail"])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return ""
|
|
|
|
+}
|